*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
$I[descriptionreg]
"; echo "'; if($_SERVER['REQUEST_METHOD']==='POST'){ try{ $db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]); }catch(PDOException $e){ exit($I['nodb']); } $stmt=$db->prepare('SELECT * FROM ' . PREFIX . 'registered WHERE api_key=?;'); do{ if(function_exists('random_bytes')){ $key=bin2hex(random_bytes(16)); }else{ $key=md5(uniqid('', true).mt_rand()); } $stmt->execute([$key]); }while($stmt->fetch(PDO::FETCH_NUM)); $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'registered (api_key) VALUES (?);'); $stmt->execute([$key]); if(isset($_REQUEST['preload'])){ settype($_REQUEST['preload'], 'int'); if($_REQUEST['preload']>0){ $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'visitors (id, time, count) VALUES ((SELECT id FROM ' . PREFIX . 'registered WHERE api_key=?), 0, ?)'); $stmt->execute([$key, $_REQUEST['preload']]); } } echo ''.sprintf($I['regsuccess'], $key).'
'; }else{ $key='YOUR_API_KEY'; } echo "$I[embedinstruct]
";
echo '<a href="' . BASEURL . "visits.php?id=$key"><img style="height:24px;width:auto;" src="" . BASEURL . "counter.php?id=$key&bg=000000&fg=FFFFFF&tr=0&unique=0&mode=0"></a>
$I[modifyinstruct]
"; echo '