Do it in the same way you'd write any data to a file. Or, mail it to you. Any number of options.
function logLogin($user) {
$time=date('r');
$file="/my/logfile.txt";
$str="$user logged in to the site at $time.\n";
$fp=fopen($file, 'a');
$write=fwrite($fp, $str);
$fc=fclose($fp);
}
Notice I've got no error checking ... some things you should do yourself... 😉
Use it thus, on the script that processes your login form...
if ($user=$username && $pw=$userpass) {
logLogin();
header("Location: https://my.secure.page");
} else {
header("Location: http://www.fbi.gov?msg=jail%20this%cracker");
}
😃