Skip to content

Instantly share code, notes, and snippets.

@jwne
Forked from Mat-Xel/PHP IP Logger
Created March 15, 2016 15:13
Show Gist options
  • Save jwne/f262c4d9d5e240a18317 to your computer and use it in GitHub Desktop.
Save jwne/f262c4d9d5e240a18317 to your computer and use it in GitHub Desktop.
(c) Mat-Xel
----- INDEX ----
<?php
$addr=getenv('REMOTE_ADDR');
$dt=date("d/m/Y - H:i:s");
$write=$dt.(" => ").$addr."\n";
$file=fopen("iplog/iplog.txt","a") or die("Error");
fwrite($file,$write);
?>
---- LOG DELETER ----
...
<body>
<center>
<br><br><br>
<h1>
MatXel IP Log deleter
</h1>
<form action="delete.php" method="post">
Delete logs? (1/0) <input type="text" name="del" />
<input type="submit" />
</form>
</center>
</body>
...
---- LOG DELETER (act. script) ----
<?php
if ($_POST["del"]==1)
{
$fop=fopen("iplog.txt","w") or die("Error");
$dt=date("d/m/Y - H:i:s");
$done="-------------------->LOG WAS DELETED HERE<--------------------\n Current time was - $dt \n \n";
fwrite($fop,$done);
echo '<font color="red">'.'<h1>'.'IP Log deleted!'.'</h1>'.'</font>';
echo "<br><br><br>";
echo 'Click <a href="/iplog/iplog.txt">'."HERE"."</a>"." to check.";
}
else
{
echo "<h1>"."IP Log preserved - your choice."."</h1>"."<br><br>";
echo '<font size="1">'.'Value different from 1 was chosen'.'</font>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment