3 $hash = explode("/", $_SERVER["REQUEST_URI"])[1];
5 $fpr{"remoteaddr"} = $_SERVER['REMOTE_ADDR'];
6 $fpr{"httpxforwarded"} = $_SERVER['HTTP_X_FORWARDED_FOR'];
7 $fpr{"time"} = date("Y-m-d H:i:s");
8 foreach (getallheaders() as $key => $value) {
9 if ($key == "User-Agent") {
10 $fpr{"useragent"} = $value;
11 } elseif ($key == "Upgrade-Insecure-Requests") {
12 $fpr{"upgradeinsecure"} = $value;
13 } elseif ($key == "Host") {
14 $fpr{"host"} = $value;
15 } elseif ($key == "Dnt") {
17 } elseif ($key == "Connection") {
18 $fpr{"connection"} = $value;
19 } elseif ($key == "Cache-Control") {
20 $fpr{"cachecontrol"} = $value;
21 } elseif ($key == "Accept-Language") {
22 $fpr{"acceptlanguage"} = $value;
23 } elseif ($key == "Accept-Encoding") {
24 $fpr{"acceptencoding"} = $value;
25 } elseif ($key == "Accept") {
26 $fpr{"accept"} = $value;
30 class wwwdb extends SQLite3 {
31 function __construct() {
32 $this->open('/botnow/botnow.db');
37 echo $wwwdb->lastErrorMsg();
39 foreach ($fpr as $key => $value) {
43 $keystr = '"'.implode('","', $keys).'"';
44 $valstr = '"'.implode('","', $values).'"';
46 INSERT INTO www ($keystr)
50 if (!$wwwdb->exec($sql)) {
51 echo $db->lastErrorMsg();
58 $ret = $wwwdb->query($sql);
59 while($row = $ret->fetchArray(SQLITE3_ASSOC)) {
60 // echo "hash: $hash, row['hashid']: ".$row['hashid']."<br>\n";
61 if ($hash == $row['hashid']) {
62 $captcha = $row['captcha'];
67 // echo "Records created successfully\n";
71 // The capcha will be stored
73 $_SESSION["captcha"] = $captcha;
75 // Generate a 50x24 standard captcha image
76 $im = imagecreatetruecolor(250, 120);
79 $bg = imagecolorallocate($im, 22, 86, 165);
82 $fg = imagecolorallocate($im, 255, 255, 255);
84 // Give the image a blue background
85 imagefill($im, 0, 0, $bg);
87 // Print the captcha text in the image
88 // with random position & size
89 //imagestring($im, 5, rand(1, 40), rand(1, 40), $captcha, $fg);
90 imagettftext($im , 96, 0, rand(0,130), 120-rand(0,60), $fg , 'intuitive.ttf', $captcha);
91 //imagettftext($im , 96, 0, rand(20, 50), rand(20, 50), $fg , 'eczar.ttf', $captcha);
93 // VERY IMPORTANT: Prevent any Browser Cache!!
94 header("Cache-Control: no-store,
95 no-cache, must-revalidate");
97 // The PHP-file will be rendered as image
98 header('Content-type: image/png');
100 // Finally output the captcha as
101 // PNG image the browser