·做了一个投票放在微信订阅号上,通过cookie来实现禁止刷票,这个真是只能防君子不能防小人,出现了恶意刷票;所以最后改为用IP来限制; 因为是一个短暂的活动,就把IP的记录写入了文件,没有再写入表中; 我的验证规则是:同个ID 对应的同一个IP3分钟内只
·做了一个投票放在微信订阅号上,通过cookie来实现禁止刷票,这个真是只能防君子不能防小人,出现了恶意刷票;所以最后改为用IP来限制;
因为是一个短暂的活动,就把IP的记录写入了文件,没有再写入表中;
我的验证规则是:同个ID 对应的同一个IP3分钟内只能投一票;
代码写的不是很好,急着上交 ,先看着吧 ,以后再完善
function GetIP() { if ($_SERVER["HTTP_X_FORWARDED_FOR"]) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if ($_SERVER["HTTP_CLIENT_IP"]) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if ($_SERVER["REMOTE_ADDR"]) $ip = $_SERVER["REMOTE_ADDR"]; else if (getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknown"; return $ip; } $iptxt = fopen("./data/lovewall.txt", "a+"); $ip = GetIP(); $ifok = $i = 1; while (!feof($iptxt)) { $now = fgets($iptxt);//获取遍历行的内容 if(!empty($now)){ $now_arr = explode('#',$now); if($now_arr[1]==$ip&&$now_arr[2]==$_G['gp_show']."\n"){ $ifok = 0; if($now_arr['0']+180>time()){ $return = array('status'=>0,'err_msg'=>'一封情书三分钟内只限赠送一次哦'); echo json_encode($return); exit; }else{ $all = file_get_contents('./data/lovewall.txt'); $new = time().'#'.$ip.'#'.$_G['gp_show']."\n"; $update_str = str_replace($now,$new, $all);//替换 间接实现修改 file_put_contents('./data/lovewall.txt', $update_str); } } } $i++; } if($ifok){ $now = time()."#".$ip."#".$_G['gp_show']; fwrite($iptxt,$now."\n"); } fclose($iptxt);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
