background image

setType($month,"integer");
if($month<10){
setType($month,"string");
$month=0.$month;}
setType($day,"integer");
if($day<10){
setType($day,"string");
$day=0.$day;}
setType($hour,"integer");
if($hour<10){
setType($min,"string");
$hour=0.$hour;}
setType($min,"integer");
if($min<10){
setType($min,"string");
$min=0.$min;}
echo <br>.$time_string=$year.$month.$day.$hour.$min.$sec;
// echo "<br>$year-$month-$day $hour-$min-$sec<br>";
// echo ("<br>");
$query="select   id   from   logging   where   user_id=$id   and   logging_ip=$ip   and 
view_time>$time_string;";
$result=mysql_db_query("web",$query,$link);
$count=mysql_num_rows($result);
if($count==0){
//   echo   $query="insert   into   logging(user_id,logging_ip,page_name)   values 
(a684dd572b1887661782981659331eed,$ip,$page_name);";
$result=mysql_db_query("web",$query,$link);
return (0);
}
else{
$query="insert into logging(user_id,logging_ip,page_name) values($id,$ip,$page_name)";
$result=mysql_db_query("web",$query,$link);
return (1);
}
}//end if

function validate-id---------
  这个验证方法很简单,而且没有考虑到用户在登录后再登录的情况,大家可以自己
加上。
  如果用 cookies,可能用 setcookies()建立用户 ID,再从环境变量$HTTP_COOKIE 或
$HTTP_COOKIE_VARS 中读
取。都是一样的,不过应该保证用户没有 cookies。