BR
asked on
PHP-Client-Registration-Login article and saving last last login
Dear Experts,
I use Ray Paseur's greate article for PHP Client Registration and Access control for my users.
https://www.experts-exchange.com/articles/2391/PHP-Client-Registration-Login-Logout-and-Easy-Access-Control.html
https://www.experts-exchan ge.com/art icles/2391 /PHP-Clien t-Registra tion-Login -Logout-an d-Easy-Acc ess-Contro l.html
I'm doing great,
I have an update statement on login page, I update my user's last login to my login table everytime my user succesfully use this page.
But most of the time, the users connect to my web site thanks to remember me cookie.
so that, I have the date of my client when they use my login page but it doesn't show actually when they loged in. ( because they connect my page with remember me cookie )
What do you suggest I should do? I thought I should create an update statements before extending remember cookie,
but would it be enough? should I also create an update statement inside access_control function?
what do you suggest I should do?
On the config file
I use Ray Paseur's greate article for PHP Client Registration and Access control for my users.
https://www.experts-exchange.com/articles/2391/PHP-Client-Registration-Login-Logout-and-Easy-Access-Control.html
https://www.experts-exchan
I'm doing great,
I have an update statement on login page, I update my user's last login to my login table everytime my user succesfully use this page.
But most of the time, the users connect to my web site thanks to remember me cookie.
so that, I have the date of my client when they use my login page but it doesn't show actually when they loged in. ( because they connect my page with remember me cookie )
What do you suggest I should do? I thought I should create an update statements before extending remember cookie,
but would it be enough? should I also create an update statement inside access_control function?
what do you suggest I should do?
On the config file
// IF THE QUERY SUCCEEDED
if ($res)
{
// THERE SHOULD BE ONE ROW
$num = $res->num_rows;
if ($num)
{
// RETRIEVE THE ROW FROM THE QUERY RESULTS SET
$row = $res->fetch_assoc();
// STORE THE USER-ID IN THE SESSION ARRAY
$_SESSION["uid"] = $row["uid"];
// I SAVE THE LAST SESSION DATE
// $mydate = date("Y-m-d H:i:s");
// $sql2 = "UPDATE mytable SET lastCookieLogin='$mydate' WHERE uid = '$uid'";
// $res2 = $mysqli->query($sql2);
// EXTEND THE "REMEMBER ME" COOKIE
remember_me($uuk);
}
}
ASKER
Dear Julian Hansen,
Actually I want to learn my client's last visit of my website.
My clients visit my home page frequently. if I use an update statement on my index page to save the visit date, I think I will get when they last visit my page.
do you recommend that?
Actually I want to learn my client's last visit of my website.
My clients visit my home page frequently. if I use an update statement on my index page to save the visit date, I think I will get when they last visit my page.
do you recommend that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Ray Paseur,
I also use Google analytics, Google Analytics shows me great deal of data..
I can even see how many users are on my site right now.
however, I can not see who are on my site.
as you and Julian Hansen said, Timestamp will be a good solution for what I need.
Thank you both
I also use Google analytics, Google Analytics shows me great deal of data..
I can even see how many users are on my site right now.
however, I can not see who are on my site.
as you and Julian Hansen said, Timestamp will be a good solution for what I need.
Thank you both
You are welcome.
I would separate the actual process of logging in from that of accessing the site. Keep the last login as part of the former but run an audit log to say when the site was accessed with a cookie.
However, this depends on your requirements. How do you plan to use this data - that will really drive the best way to do this.