1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
mysql_connect("localhost","username","userpassword")or die(mysql_error());
mysql_select_db("userdb")or die(mysql_error());
$ip=getenv('REMOTE_ADDR');
$sql=mysql_query("mysql_query("INSERT INTO `ip_table` (`IP`, `DateTime`) VALUES ('".$ip."', '".time()."')");
if($sql) {
echo "Die IP wurde erfolgreich eintgetragen!";
}
else {
echo "Es liegt ein fehler vor: ".mysql_error();
}
mysql_close();
?>
Naja hoffe der Code geht, hab ich einfach mal geschrieben ohne zu testen1
2
3
4
5
6
7
<?php
$ip=getenv('REMOTE_ADDR');
$host=gethostbyaddr($ip);
$file=fopen("iptabelle.txt","w+a");
fwrite($file, $ip.":".$host.":".date(".d.m.Y - H:i",time())."\n\r");
fclose($file);
?>