users with same ip address or same browser cant visit again on site.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    users with same ip address or same browser cant visit again on site.

    plz give me code to auto block users with same ip address or same browser.

    #2
    Originally posted by wapjar View Post
    plz give me code to auto block users with same ip address or same browser.
    $tm = time();
    $r=rand(97, 619);
    $xtm = $tm + (getsxtm()*60);
    $did = $uid.$tm.$r;
    $sid = md5($did);
    //session already existing? Then don't use new///
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE uid='$idn' AND expiretm>$tm"));
    if($res[0]>0){
    $res=mysql_fetch_array(mysql_query("SELECT id FROM ibwf_ses WHERE uid='$idn'"));
    $sid=$res[0];
    $flag=0;
    }
    else $flag=1;
    if($flag){
    $res=mysql_query("INSERT INTO ibwf_ses SET id='".$sid."', uid='".$idn."', expiretm='".$xtm."', ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."'");
    }
    else
    $res=mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."', ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."' WHERE uid='".$idn."'");
    //////Logs code///
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ua WHERE ua='".$HTTP_USER_AGENT."' AND uid=$idn"));
    if($res[0]>0){
    mysql_query("UPDATE ua SET time=$tm WHERE ua='".$HTTP_USER_AGENT."' AND uid=$idn");
    }
    else if($res[0]==0){
    mysql_query("INSERT INTO ua VALUES(NULL, $idn, '".$HTTP_USER_AGENT."', $tm)");
    }
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ip WHERE ip='$REMOTE_ADDR' AND uid=$idn"));
    if($res[0]>0){
    mysql_query("UPDATE ip SET time=$tm WHERE ip='$REMOTE_ADDR' AND uid=$idn");
    }
    else if($res[0]==0){
    mysql_query("INSERT INTO ip VALUES(NULL, $idn, '$REMOTE_ADDR',$tm)");
    }
    if($number){
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM number WHERE number='$number' AND uid=$idn"));
    if($res[0]>0){
    mysql_query("UPDATE number SET time=$tm WHERE msi='$number' AND uid=$idn");
    }
    else if($res[0]==0){
    mysql_query("INSERT INTO number VALUES(NULL, $idn, '$number',$tm)");
    }
    }
    if($HTTP_X_FORWARDED_FOR){
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fwdip WHERE fwdip='$HTTP_X_FORWARDED_FOR' AND uid=$idn"));
    if($res[0]>0){
    mysql_query("UPDATE fwdip SET time=$tm WHERE fwdip='$HTTP_X_FORWARDED_FOR' AND uid=$idn");
    }
    else if($res[0]==0){
    mysql_query("INSERT INTO fwdip VALUES(NULL, $idn, '$HTTP_X_FORWARDED_FOR',$tm)");
    }
    }
    if($opminfon){
    $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM opminfon WHERE opminfon='$opminfon' AND uid=$idn"));
    if($res[0]>0){
    mysql_query("UPDATE opminfon SET time=$tm WHERE opminfon='$opminfon' AND uid=$idn");
    }
    else if($res[0]==0){
    mysql_query("INSERT INTO opminfon VALUES(NULL, $idn, '$opminfon',$tm)");
    }
    }
    ////////////visits
    $addhitv = mysql_fetch_array(mysql_query("SELECT visit FROM ibwf_users WHERE id='".$idn."'"));
    $addv = $addhitv[0] + 1;
    $addvisit = mysql_query("UPDATE ibwf_users SET visit='".$addv."' WHERE id='".$idn."'");

    Comment


      #3
      i want wapdollar.in antifraud it detect same ip and redirect same ip from adpage to other site after click on ad

      Comment


        #4
        Originally posted by manavworld View Post
        $tm = time();
        $r=rand(97, 619);
        $xtm = $tm + (getsxtm()*60);
        $did = $uid.$tm.$r;
        $sid = md5($did);
        //session already existing? Then don't use new///
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE uid='$idn' AND expiretm>$tm"));
        if($res[0]>0){
        $res=mysql_fetch_array(mysql_query("SELECT id FROM ibwf_ses WHERE uid='$idn'"));
        $sid=$res[0];
        $flag=0;
        }
        else $flag=1;
        if($flag){
        $res=mysql_query("INSERT INTO ibwf_ses SET id='".$sid."', uid='".$idn."', expiretm='".$xtm."', ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."'");
        }
        else
        $res=mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."', ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."' WHERE uid='".$idn."'");
        //////Logs code///
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ua WHERE ua='".$HTTP_USER_AGENT."' AND uid=$idn"));
        if($res[0]>0){
        mysql_query("UPDATE ua SET time=$tm WHERE ua='".$HTTP_USER_AGENT."' AND uid=$idn");
        }
        else if($res[0]==0){
        mysql_query("INSERT INTO ua VALUES(NULL, $idn, '".$HTTP_USER_AGENT."', $tm)");
        }
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ip WHERE ip='$REMOTE_ADDR' AND uid=$idn"));
        if($res[0]>0){
        mysql_query("UPDATE ip SET time=$tm WHERE ip='$REMOTE_ADDR' AND uid=$idn");
        }
        else if($res[0]==0){
        mysql_query("INSERT INTO ip VALUES(NULL, $idn, '$REMOTE_ADDR',$tm)");
        }
        if($number){
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM number WHERE number='$number' AND uid=$idn"));
        if($res[0]>0){
        mysql_query("UPDATE number SET time=$tm WHERE msi='$number' AND uid=$idn");
        }
        else if($res[0]==0){
        mysql_query("INSERT INTO number VALUES(NULL, $idn, '$number',$tm)");
        }
        }
        if($HTTP_X_FORWARDED_FOR){
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fwdip WHERE fwdip='$HTTP_X_FORWARDED_FOR' AND uid=$idn"));
        if($res[0]>0){
        mysql_query("UPDATE fwdip SET time=$tm WHERE fwdip='$HTTP_X_FORWARDED_FOR' AND uid=$idn");
        }
        else if($res[0]==0){
        mysql_query("INSERT INTO fwdip VALUES(NULL, $idn, '$HTTP_X_FORWARDED_FOR',$tm)");
        }
        }
        if($opminfon){
        $res=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM opminfon WHERE opminfon='$opminfon' AND uid=$idn"));
        if($res[0]>0){
        mysql_query("UPDATE opminfon SET time=$tm WHERE opminfon='$opminfon' AND uid=$idn");
        }
        else if($res[0]==0){
        mysql_query("INSERT INTO opminfon VALUES(NULL, $idn, '$opminfon',$tm)");
        }
        }
        ////////////visits
        $addhitv = mysql_fetch_array(mysql_query("SELECT visit FROM ibwf_users WHERE id='".$idn."'"));
        $addv = $addhitv[0] + 1;
        $addvisit = mysql_query("UPDATE ibwf_users SET visit='".$addv."' WHERE id='".$idn."'");
        Missing quotes '".$string."'
        and setting yourself up for mysql injection big time :/
        and no sql
        and too many calls to database makes your server work harder than it needs to ;)
        and missing function getsxtm()
        Last edited by something else; 06.02.12, 17:20.

        Comment


          #5
          what kind of bl0cker,,i have a c0de buti in register f0rm..user of the same ip address cann0t register.

          Comment

          Working...
          X