53 lines
2 KiB
PHP
53 lines
2 KiB
PHP
<?
|
|
$img = "/www/stamp/images/CAverify.png";
|
|
$arr = explode("//", mysql_real_escape_string(trim($_REQUEST['refer'])), 2);
|
|
$arr = explode("/", $arr['1'], 2);
|
|
$ref = $arr['0'];
|
|
|
|
header('Content-type: image/png');
|
|
$im = imagecreatefrompng($img);
|
|
|
|
$query = "select * from `domlink`,`domains`,`domaincerts`
|
|
where `domlink`.`domid`=`domains`.`id` and `domlink`.`certid`=`domaincerts`.`id` and `domaincerts`.`revoked`=0 and
|
|
`domaincerts`.`subject` like '%subjectAltName=DNS:$ref/%' order by `domaincerts`.`id`";
|
|
$res = mysql_query($query);
|
|
if(mysql_num_rows($res) <= 0)
|
|
{
|
|
$bits = explode(".", $ref);
|
|
for($i = 1; $i < count($bits); $i++)
|
|
{
|
|
if($ref2 != "")
|
|
$ref2 .= ".";
|
|
$ref2 .= $bits[$i];
|
|
}
|
|
$query = "select * from `domlink`,`domains`,`domaincerts`
|
|
where `domlink`.`domid`=`domains`.`id` and `domlink`.`certid`=`domaincerts`.`id` and `domaincerts`.`revoked`=0 and
|
|
(`domaincerts`.`subject` like '%subjectAltName=DNS:$ref2/%' or `domaincerts`.`subject` like '%subjectAltName=DNS:*.$ref2/%')
|
|
order by `domaincerts`.`id`";
|
|
$res = mysql_query($query);
|
|
if(mysql_num_rows($res) <= 0)
|
|
{
|
|
$query = "select * from `orgdomaincerts`,`orgdomlink`,`orgdomains` where `orgdomaincerts`.`revoked`=0 and
|
|
(`orgdomaincerts`.`subject` like '%=$ref%' or `orgdomaincerts`.`subject` like '%=*.$ref2%') and
|
|
`orgdomaincerts`.`id`=`orgdomlink`.`orgcertid` and `orgdomlink`.`orgdomid`=`orgdomains`.`id`";
|
|
$res = mysql_query($query);
|
|
if(mysql_num_rows($res) <= 0)
|
|
{
|
|
$tc = imagecolorallocate ($im, 255, 0, 0);
|
|
imagestring ($im, 2, 1, 30, "INVALID DOMAIN", $tc);
|
|
imagestring ($im, 2, 1, 45, "Click to Report", $tc);
|
|
imagepng($im);
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
|
|
$tz = intval($_REQUEST['tz']);
|
|
$now = date("Y-m-d", gmmktime("U") + ($tz * 3600));
|
|
|
|
$tc = imagecolorallocate ($im, 0, 0, 0);
|
|
imagestring ($im, 4, 1, 27, "Valid Cert!", $tc);
|
|
imagestring ($im, 1, 7, 42, "Click to Verify", $tc);
|
|
imagestring ($im, 1, 20, 52, $now, $tc);
|
|
imagepng($im);
|
|
?>
|