php by Barttos http barttos net me barttos net db_sv mysql_connect loc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
* by Barttos
* http://barttos.net/
* me@barttos.net
*/
$db_sv = mysql_connect("localhost", "root", "");
mysql_select_db("sandbox", $db_sv);
/* * */
$counter_id = intval($_GET['id']);
if ($counter_id == 0) die();
mysql_query("UPDATE counter SET visits = visits+1 Where id = $counter_id");
$r = mysql_query("SELECT visits FROM counter WHERE id = $counter_id");
$counter_array = mysql_fetch_array($r);
header("Content-type: image/png");
header("Cache-control: no-cache");
header("Pragma: no-cache" );
$counter = imagecreate(37, 27);
$background = imagecolorallocate($counter, 255, 255, 255);
$color = imagecolorallocate($counter, 0, 0, 255);
imagestring($counter, 5, 5, 5, $counter_array['visits'], $color);
imagepng($counter);
imagedestroy($counter)