Hello,
Not sure if this is easily achieved, but I'm using a PHP login script (based on sessions) that I created.
I want to add two session variables which contains the time a user logged in and the date.
For the date syntax we wanted to use something like: 21/04/2005
For the time syntax: 14:34:33
and then be able to echo each out - so for example two variables 'LOGINDATE' and 'LOGINTIME'
I've tried all various forms of using date() but after about a minute I just get figures like 2893292... how else can I do this please?
We are not using any form of database for the login script, the actual logins are in our 'login.php' encrypted as MD5 hashes for the passwords.
$_SESSION['logindate'] = date("d/m/Y");
$_SESSION['logintime'] = date("H:i:s");
The only way I've managed to get this going is with cookies, though I really wanted to keep using sessions for it all.
At the moment (working) we're using in my login.php:
setcookie('logindate', date('d/m/Y'));
setcookie('logintime', date('H:i:s'));
and echo'ing it out with:
echo $_COOKIE['logindate'];
echo $_COOKIE['logintime'];
Our logout.php (to unset the logged in session variable, and unset the cookies is like):
include_once('/home/us/protect.php');
setcookie('logindate', '', time()-60);
setcookie('logintime', '', time()-60);
unset($_SESSION['logged']);
header("Location: [url]http://www.domain.com/secure/login.php[/url]");
exit();
Any help on this would be very much appreciated.
Thank you.