global $HTTP_GET_VARS, $HTTP_SERVER_VARS, $REMOTE_ADDR, $REQUEST_URI, $HTTP_HOST, $HTTP_REFERER; session_start(); $myVars = $HTTP_GET_VARS ; if (!$myVars['user']) { $gif = ImageCreate(88,31); $bg = ImageColorAllocate($gif,0,0,0); $tx = ImageColorAllocate($gif,255,255,255); ImageFilledRectangle($gif,0,0,200,200,$bg); $str= "abretesesamo.com"; ImageString($gif,0,0,12, $str,$tx); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("content-type: image/jpeg"); ImageJPEG($gif); exit(); } $q= new tbl; $query = "insert into visitors (sesion, request_uri, domain, timestamp, ip, referer, user) values ('"; $query .=session_id()."', '".$REQUEST_URI."', '". $HTTP_HOST."', ". time().", '". $REMOTE_ADDR."', "; $query .="'".$HTTP_REFERER. "', '". $myVars['user'] ."' )"; $q->query($query); $now = time() - 300; $query = "select count(ip) from visitors where timestamp >= ".$now ." and user=".$myVars['user']; $query .=" and domain='". $HTTP_HOST."' group by sesion"; $q->query($query); $q->next_record(); $visitorsNow = $q->num_rows(); $date = getdate(); $day = $date[mday]; $mon = $date[mon]; $year = $date[year]; $today = mktime(0,0,0,$mon, $day, $year); $query = "select count(ip) from visitors where timestamp > ".$today." and user=".$myVars['user']; $query .=" and domain='". $HTTP_HOST."' group by ip"; $q->query($query); $uniqueVisitors = $q->num_rows(); $query = "select count(sesion) from visitors where user=".$myVars['user']; $query .=" and domain='". $HTTP_HOST."' group by sesion"; $q->query($query); $totalVisitors = $q->num_rows(); $q->free(); $gif = ImageCreate(88,31); $bg = ImageColorAllocate($gif,0,0,0); $tx = ImageColorAllocate($gif,255,255,255); ImageFilledRectangle($gif,0,0,200,200,$bg); $str= "Ahora: ".$visitorsNow; $str1="Unicas: ". $uniqueVisitors; $str2="Totales: ".$totalVisitors; ImageString($gif,0,0,5, $str,$tx); ImageString($gif,0,0,13, $str1, $tx); ImageString($gif,0,0,21, $str2, $tx); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("content-type: image/jpeg"); ImageJPEG($gif); exit();