I don't script in php for long.. so first thanks for the replies.
The code I used now was:
$log_data = "$date, $ip, $username, $error \r\n";
$log = file_put_contents("logs/login.log", $log_data, FILE_APPEND | LOCK_EX);
with these variables:
$date = date("Y-m-d H:i:s");
$ip = GetHostByName("REMOTE_ADDR");
wich outputs: (ip blurred)
2013-08-19 13:28:28, x7.2xx.x5.x32, Vul alles in aub!
2013-08-19 13:28:54, x7.2xx.x5.x32, Vul alles in aub!
2013-08-19 13:28:58, x7.2xx.x5.x32, Vul alles in aub!
2013-08-19 13:29:34, x7.2xx.x5.x32, admin, Login Succesvol!
2013-08-19 13:35:02, x7.2xx.x5.x32, admin, Login Succesvol!
2013-08-19 14:58:37, x7.2xx.x5.x32, admin Succesvol Uitgelogt!
2013-08-19 14:58:44, x7.2xx.x5.x32, Paul, Logingegevens onjuist!
2013-08-19 14:58:50, x7.2xx.x5.x32, admin, Login Succesvol!
again: Thnx all
(sorry for bad English, I'm from Holland)