• 0

Edit PHP IP Logging Script


Question

I have this so far in the script:

<?php 
$logfile= '/$IP/$IP.txt'; //IP Log Directory.
$IP = $_SERVER['REMOTE_ADDR']; //IP logging code
$logdetails= Nub hacker. You will be banned for 1 week in 24 hours. //Laugh at the hacker
echo("Your IP has been logged. Pwned nub hacker: /$IP/$IP.txt"); //Laugh more at the hacker. 
?>

Is there anything wrong with this? If not then I'll use this. Just looking for opinions here.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

What's the point in banning someone in 24 hours? If you detect someone's done something they shouldn't have - limit their access there and then. Giving them 24 hours to commit more nasties is pointless really :p

Banning by IP is risky anyway. There's a good chance you'll catch innocent parties because of ISPs sharing IP addresses and mixing them up a bit between customers. Also, it's damn easy for a determined 'hacker' to run through another proxy and hide their IP.

Link to comment
Share on other sites

  • 0

I have this so far in the script:

<?php 
$logfile= '/$IP/$IP.txt'; //IP Log Directory.
$IP = $_SERVER['REMOTE_ADDR']; //IP logging code
$logdetails= Nub hacker. You will be banned for 1 week in 24 hours. //Laugh at the hacker
echo("Your IP has been logged. Pwned nub hacker: /$IP/$IP.txt"); //Laugh more at the hacker. 
?>

Is there anything wrong with this? If not then I'll use this. Just looking for opinions here.

The usefulness of this function aside, and purely looking at your code, you need to define the $IP variable before it is used in the $logfile variable. So your code should look like this:

<?php 
$IP = $_SERVER['REMOTE_ADDR']; //IP logging code
$logfile= '/$IP/$IP.txt'; //IP Log Directory.
$logdetails= Nub hacker. You will be banned for 1 week in 24 hours. //Laugh at the hacker
echo("Your IP has been logged. Pwned nub hacker: /$IP/$IP.txt"); //Laugh more at the hacker. 
?>

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.