search
Homephp教程php手册投票系统防刷代码

投票系统防刷代码

Jun 13, 2016 am 11:22 AM
cookieemptycodevotesystemAnti-brush

投票系统防刷代码

$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       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       } 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      if (!eregi ("^(10|172.16|192.168).", $ips[$i])) {
      $ip = $ips[$i];
      break;
     }
    }
   }
   return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
 }


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor