I have a problem killing me. I want to log who and when people login. For that purpose I have a table:
id int (masterkey with autoinc)
user VARCHAR(50)
ip VARCHAR(50)
when VARCHAR(50)
On successfull login the following code works fine:
function AfterSuccessfulLogin()
{
//** Insert a record into another table ****
global $conn;
$Username = @$_SESSION["UserID"];
$IP = $_SERVER["REMOTE_ADDR"];
$strSQLInsert = "insert into `_vaben_LogUser` (user, ip) values ('$Username', '$IP')";
db_exec($strSQLInsert,$conn);
}
But this code causes a PHP error:
function AfterSuccessfulLogin()
{
//** Insert a record into another table ****
global $conn;
$Username = @$_SESSION["UserID"];
$IP = $_SERVER["REMOTE_ADDR"];
$when = date('Y-m-d H:i');
$strSQLInsert = "insert into `_vaben_LogUser` (user, ip, when) values ('$Username', '$IP', '$when')";
db_exec($strSQLInsert,$conn);
What is wrong?
Rgds
Morten Jepsen