Loading ...
Sorry, an error occurred while loading the content.

IP baning.

Expand Messages
  • zeshanism <zeshanism@yahoo.com>
    Its over 2 days and I don t know what I m doing wrong. Please help me. Just a simple file writing script to write an IP address on the file, ip.block.dat ...
    Message 1 of 1 , Mar 4, 2003
    • 0 Attachment
      Its over 2 days and I don't know what I m doing wrong.

      Please help me.
      Just a simple file writing script to write an IP address on the file,
      ip.block.dat

      --------
      open (LOGFILE, ">> ipblock.dat") ;
      print LOGFILE "$ip\n" ;
      close (LOGFILE) ;
      --------

      Now what I want to retreive the IP's from the the ipblock.dat file
      and match them with the user's IP ($ENV{'REMOTE_ADDR'}) and if its
      found in the file the browser should an error that IP is ban...

      -------
      open (IPBLOCK, "ipblock.dat") || &showerror("opening ipblock list.");
      @blockip = <IPBLOCK>;
      close(IPBLOCK);
      foreach $ips(@blockip) {
      chop($ips);
      $blocked = $ips;
      }
      if ($ip eq $blocked){
      &error(ip_blocked);

      --------

      THE PROBLEM IS.... it reads the last blocked IP from the file
      ipblock.dat and doesn't not check the remaining IPs in the list.

      ANY help or any alternative way to ban the user's IP?

      Thanks.
    Your message has been successfully submitted and would be delivered to recipients shortly.