Password protection for voting systems

Source: Internet
Author: User
Tags explode password protection

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 ']);
 }

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.