Voting system anti-brush Code _php Tutorial

Source: Internet
Author: User
Tags setcookie
voting system anti-brush Code

$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 di E (' 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 ');
}


http://www.bkjia.com/PHPjc/445068.html www.bkjia.com true http://www.bkjia.com/PHPjc/445068.html techarticle voting system anti-brush Code $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);

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.