home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Shareware / Programare / cnstats / reports / logout.php < prev    next >
Encoding:
PHP Script  |  2004-08-10  |  446 b   |  13 lines

  1. <?
  2. $r=cnstats_sql_query("SELECT hash FROM cns_config;");
  3. $hashs=explode("-",mysql_result($r,0,0));
  4. for ($i=0;$i<count($hashs);$i++) if (strlen($hashs[$i])!=32 || $hashs[$i]==$HTTP_COOKIE_VARS["CNSSESSION"]) unset($hashs[$i]);
  5.  
  6. if (count($hashs)>5) array_shift($hashs);
  7. array_push($hashs,$hash);
  8.  
  9. cnstats_sql_query("UPDATE cns_config SET hash='".implode("-",$hashs)."';");
  10.  
  11. setcookie("CNSSESSION","");
  12. header("Location: index.php");
  13. ?>