Password protection for voting systems
$ 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.net
$ 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 ('A ');
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.net
} 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.net
*/
@ 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 ']);
}