troll $id => $date with ip:$ip"; } } function extract_troll_id($rez) { $tag1 = "IDPJ="; $tag2 = "&"; $pos1 = stripos($rez, $tag1); $pos2 = stripos($rez, $tag2, $pos1); if (($pos1 === false)) {return "pb";} if ($pos2 == false) { $rez = substr($rez,$pos1+strlen($tag1)); } else { $rez = substr($rez,$pos1+strlen($tag1), $pos2-$pos1-strlen($tag1)); } return $rez; } function display_hits_since($trollid, $nbhours) { openconnexion(); $delay = $nbhours * 3600; $query = "Select count(trollid) FROM `MHcount` WHERE trollid=\"$trollid\" and UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(date) <= $delay; "; $r = @mysql_query($query) or die("pb insert_hit : $query"); return mysql_result($r , 0 , 0); } function main() { if ($_GET['troll'] <> '') { print_r($_REQUEST); $trollid = $_GET['troll']; display_hits($trollid); return; } if ($_GET['danger'] <> '') { $trollid = $_GET['danger']; $danger_24 = display_hits_since($trollid, 24); $danger_12 = display_hits_since($trollid, 12); $danger_6 = display_hits_since($trollid, 6); $danger_3 = display_hits_since($trollid, 3); $danger_1 = display_hits_since($trollid, 1); //return; $image = imagecreate(100, 20); // create a red colour for the background // as it is the first call to imagecolorallocate(), this fills the background automatically $red_background = imagecolorallocate($image, 0, 0, 0); // create a black colour for writing on the image $black = imagecolorallocate($image, 255, 255,255); // write the string "Hyve test" on the image // the top left of the text is at the position (10, 2) imagestring($image, 2, 2, 2," $danger_1 $danger_3 $danger_6 $danger_12 $danger_24", $black); // output the image // tell the browser what we.re sending it Header('Content-type: image/png'); // output the image as a png imagepng($image); // tidy up imagedestroy($image); } $ref = extract_troll_id($_SERVER['HTTP_REFERER']); $ip = $_SERVER['REMOTE_ADDR']; insert_hit ($ref, $ip); //print_r($_REQUEST); $image = imagecreate(1, 1); // create a red colour for the background // as it is the first call to imagecolorallocate(), this fills the background automatically $red_background = imagecolorallocate($image, 0, 0, 0); // create a black colour for writing on the image $black = imagecolorallocate($image, 0, 0, 0); // write the string "Hyve test" on the image // the top left of the text is at the position (10, 2) imagestring($image, 4, 10, 2," $ref", $black); // output the image // tell the browser what we.re sending it Header('Content-type: image/png'); // output the image as a png imagepng($image); // tidy up imagedestroy($image); } main(); ?>