Blame
Date:
Fri Dec 17 13:35:57 2021 UTC
Message:
Imported sources
001
2021-12-17
jrmu
<?php
002
2021-12-17
jrmu
003
2021-12-17
jrmu
$hash = explode("/", $_SERVER["REQUEST_URI"])[1];
004
2021-12-17
jrmu
$fpr{"hash"} = $hash;
005
2021-12-17
jrmu
$fpr{"remoteaddr"} = $_SERVER['REMOTE_ADDR'];
006
2021-12-17
jrmu
$fpr{"httpxforwarded"} = $_SERVER['HTTP_X_FORWARDED_FOR'];
007
2021-12-17
jrmu
$fpr{"time"} = date("Y-m-d H:i:s");
008
2021-12-17
jrmu
foreach (getallheaders() as $key => $value) {
009
2021-12-17
jrmu
if ($key == "User-Agent") {
010
2021-12-17
jrmu
$fpr{"useragent"} = $value;
011
2021-12-17
jrmu
} elseif ($key == "Upgrade-Insecure-Requests") {
012
2021-12-17
jrmu
$fpr{"upgradeinsecure"} = $value;
013
2021-12-17
jrmu
} elseif ($key == "Host") {
014
2021-12-17
jrmu
$fpr{"host"} = $value;
015
2021-12-17
jrmu
} elseif ($key == "Dnt") {
016
2021-12-17
jrmu
$fpr{"dnt"} = $value;
017
2021-12-17
jrmu
} elseif ($key == "Connection") {
018
2021-12-17
jrmu
$fpr{"connection"} = $value;
019
2021-12-17
jrmu
} elseif ($key == "Cache-Control") {
020
2021-12-17
jrmu
$fpr{"cachecontrol"} = $value;
021
2021-12-17
jrmu
} elseif ($key == "Accept-Language") {
022
2021-12-17
jrmu
$fpr{"acceptlanguage"} = $value;
023
2021-12-17
jrmu
} elseif ($key == "Accept-Encoding") {
024
2021-12-17
jrmu
$fpr{"acceptencoding"} = $value;
025
2021-12-17
jrmu
} elseif ($key == "Accept") {
026
2021-12-17
jrmu
$fpr{"accept"} = $value;
027
2021-12-17
jrmu
}
028
2021-12-17
jrmu
}
029
2021-12-17
jrmu
030
2021-12-17
jrmu
class wwwdb extends SQLite3 {
031
2021-12-17
jrmu
function __construct() {
032
2021-12-17
jrmu
$this->open('/botnow/botnow.db');
033
2021-12-17
jrmu
}
034
2021-12-17
jrmu
}
035
2021-12-17
jrmu
$wwwdb = new wwwdb();
036
2021-12-17
jrmu
if(!$wwwdb) {
037
2021-12-17
jrmu
echo $wwwdb->lastErrorMsg();
038
2021-12-17
jrmu
} else {
039
2021-12-17
jrmu
foreach ($fpr as $key => $value) {
040
2021-12-17
jrmu
$keys[] = $key;
041
2021-12-17
jrmu
$values[] = $value;
042
2021-12-17
jrmu
}
043
2021-12-17
jrmu
$keystr = '"'.implode('","', $keys).'"';
044
2021-12-17
jrmu
$valstr = '"'.implode('","', $values).'"';
045
2021-12-17
jrmu
$sql =<<<EOF
046
2021-12-17
jrmu
INSERT INTO www ($keystr)
047
2021-12-17
jrmu
VALUES ($valstr);
048
2021-12-17
jrmu
EOF;
049
2021-12-17
jrmu
050
2021-12-17
jrmu
if (!$wwwdb->exec($sql)) {
051
2021-12-17
jrmu
echo $db->lastErrorMsg();
052
2021-12-17
jrmu
return;
053
2021-12-17
jrmu
}
054
2021-12-17
jrmu
055
2021-12-17
jrmu
$sql =<<<EOF
056
2021-12-17
jrmu
SELECT * from bnc;
057
2021-12-17
jrmu
EOF;
058
2021-12-17
jrmu
$ret = $wwwdb->query($sql);
059
2021-12-17
jrmu
while($row = $ret->fetchArray(SQLITE3_ASSOC)) {
060
2021-12-17
jrmu
// echo "hash: $hash, row['hashid']: ".$row['hashid']."<br>\n";
061
2021-12-17
jrmu
if ($hash == $row['hashid']) {
062
2021-12-17
jrmu
$captcha = $row['captcha'];
063
2021-12-17
jrmu
// echo $captcha;
064
2021-12-17
jrmu
}
065
2021-12-17
jrmu
}
066
2021-12-17
jrmu
$wwwdb->close();
067
2021-12-17
jrmu
// echo "Records created successfully\n";
068
2021-12-17
jrmu
}
069
2021-12-17
jrmu
session_start();
070
2021-12-17
jrmu
071
2021-12-17
jrmu
// The capcha will be stored
072
2021-12-17
jrmu
// for the session
073
2021-12-17
jrmu
$_SESSION["captcha"] = $captcha;
074
2021-12-17
jrmu
075
2021-12-17
jrmu
// Generate a 50x24 standard captcha image
076
2021-12-17
jrmu
$im = imagecreatetruecolor(250, 120);
077
2021-12-17
jrmu
078
2021-12-17
jrmu
// Blue color
079
2021-12-17
jrmu
$bg = imagecolorallocate($im, 22, 86, 165);
080
2021-12-17
jrmu
081
2021-12-17
jrmu
// White color
082
2021-12-17
jrmu
$fg = imagecolorallocate($im, 255, 255, 255);
083
2021-12-17
jrmu
084
2021-12-17
jrmu
// Give the image a blue background
085
2021-12-17
jrmu
imagefill($im, 0, 0, $bg);
086
2021-12-17
jrmu
087
2021-12-17
jrmu
// Print the captcha text in the image
088
2021-12-17
jrmu
// with random position & size
089
2021-12-17
jrmu
//imagestring($im, 5, rand(1, 40), rand(1, 40), $captcha, $fg);
090
2021-12-17
jrmu
imagettftext($im , 96, 0, rand(0,130), 120-rand(0,60), $fg , 'intuitive.ttf', $captcha);
091
2021-12-17
jrmu
//imagettftext($im , 96, 0, rand(20, 50), rand(20, 50), $fg , 'eczar.ttf', $captcha);
092
2021-12-17
jrmu
093
2021-12-17
jrmu
// VERY IMPORTANT: Prevent any Browser Cache!!
094
2021-12-17
jrmu
header("Cache-Control: no-store,
095
2021-12-17
jrmu
no-cache, must-revalidate");
096
2021-12-17
jrmu
097
2021-12-17
jrmu
// The PHP-file will be rendered as image
098
2021-12-17
jrmu
header('Content-type: image/png');
099
2021-12-17
jrmu
100
2021-12-17
jrmu
// Finally output the captcha as
101
2021-12-17
jrmu
// PNG image the browser
102
2021-12-17
jrmu
imagepng($im);
103
2021-12-17
jrmu
104
2021-12-17
jrmu
// Free memory
105
2021-12-17
jrmu
imagedestroy($im);
106
2021-12-17
jrmu
?>
IRCNow