All mysql_-statments replaced by their corresponding mysqli_-statements
[cacert-devel.git] / stamp / displogo.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 $img = "/www/stamp/images/CAverify.png";
19 $arr = explode("//", mysqli_real_escape_string($_SESSION['mconn'], trim($_REQUEST['refer'])), 2);
20 $arr = explode("/", $arr['1'], 2);
21 $ref = $arr['0'];
22
23 $arr = explode("//", mysqli_real_escape_string($_SESSION['mconn'], trim($_SERVER['HTTP_REFERER'])), 2);
24 $arr = explode("/", $arr['1'], 2);
25 $siteref = $arr['0'];
26
27 if($_REQUEST['debug'] != 1)
28 header('Content-type: image/png');
29 $im = imagecreatefrompng($img);
30
31 if($ref == "" || ($ref != $siteref && $siteref != ""))
32 {
33 $tc = imagecolorallocate ($im, 255, 0, 0);
34 imagestring ($im, 2, 1, 30, "INVALID DOMAIN", $tc);
35 imagestring ($im, 2, 1, 45, "Click to Report", $tc);
36 imagepng($im);
37 exit;
38 }
39
40 list($invalid, $info) = checkhostname($ref);
41
42 if($invalid > 0)
43 {
44 $tc = imagecolorallocate ($im, 255, 0, 0);
45 imagestring ($im, 2, 1, 30, "INVALID DOMAIN", $tc);
46 imagestring ($im, 2, 1, 45, "Click to Report", $tc);
47 imagepng($im);
48 exit;
49 }
50
51 $tz = intval($_REQUEST['tz']);
52 $now = date("Y-m-d", gmmktime("U") + ($tz * 3600));
53
54 $tc = imagecolorallocate ($im, 0, 0, 0);
55 imagestring ($im, 4, 1, 27, "Valid Cert!", $tc);
56 imagestring ($im, 1, 7, 42, "Click to Verify", $tc);
57 imagestring ($im, 1, 20, 52, $now, $tc);
58 imagepng($im);
59 ?>