PHP头条
热点:

投票系统防刷代码


投票系统防刷代码

$value =$this->host;     
   if(empty($_COOKIE["cook"])){
     setcookie("cook", $value, time()+1800, "/"); 
     $v_host = $this->host;   
     $v_ip = $this->get_real_ip();     
     $v_date =date("Y-m-d");   
     $v_array=explode("-",$v_date);   
     $v_mad =$v_array[1].$v_array[2];   
     $v_sql ="Select * from su_votes where v_domain='$v_host' and v_ip='$v_ip' and v_mad='$v_mad'";
     $r  =mysql_query($v_sql) or die("Error system busy.....plase wait!");
     $rs  =mysql_fetch_array($r);
     if(mysql_num_rows($r)){www.111cn.cn
       $qq  =mysql_query("Select * from des where v_domain='$v_host' and v_ip='$v_ip' and v_votes<=7  and v_mad='$v_mad'") or die('aa');
       if(mysql_num_rows($qq)){
        mysql_query("update f set visited=visited+1 where id=$this->u_id");
        mysql_query("update g set v_votes=v_votes+1 where v_domain='$v_host' and v_ip='$v_ip' and v_votes<=7  and v_mad='$v_mad'");
       } www.111cn.cn
     }else{ 
       mysql_query("insert into su_votes(v_domain,v_ip,v_date,v_votes,v_today,v_mad)value('$v_host','$v_ip','$v_date',0,1,'$v_mad')");
       mysql_query("update g set visited=visited+1 where id=$this->u_id");
     }   
   } www.111cn.cn
  */
  @mysql_query("update g set visited=visited+1 where id=$this->u_id");
 }

 /*
  get real IP
 */
 function lock_user_ip(){
 $Usql =mysql_query("select * from su_lockip");
 $Urs =mysql_fetch_array($Usql);
 $UlockIp=$Urs['lockip'];
 $ClockIp=$this->get_real_ip();
 $Iplist =explode('|',$UlockIp);
 if(in_array($ClockIp,$Iplist)){
  exit('sorry system lock your IP');
 }
 }
 
 function get_real_ip(){
   $ip=false;
   if(!empty($_SERVER["HTTP_CLIENT_IP"])){
    $ip = $_SERVER["HTTP_CLIENT_IP"];
   }
   if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
    if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }
    for ($i = 0; $i < count($ips); $i++) {
     if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i])) {
      $ip = $ips[$i];
      break;
     }
    }
   }
   return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
 }

www.phpzy.comtrue/php/9657.htmlTechArticle投票系统防刷代码 投票系统防刷代码 $value=$this-host; if(empty($_COOKIE[cook])){ setcookie(cook, $value, time()+1800, /); $v_host=$this-host; $v_ip=$this-get_real_ip(); $v_date=date(Y-m-d); $v_array=explode(-,$v_date); $v_mad...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐