Ell20 Posted April 4, 2008 Share Posted April 4, 2008 Hi, I have made a login script which redirects. However depending on whether this is the first time they have logged in depends on which page they get redirected to. This is all working fine but how do I update the database on page load so that they get redirected to the other location from then on? Cheers Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/ Share on other sites More sharing options...
gm04030276 Posted April 4, 2008 Share Posted April 4, 2008 write a function and call it on page load! Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509137 Share on other sites More sharing options...
Ell20 Posted April 4, 2008 Author Share Posted April 4, 2008 Hmm, how would you do that? Because you need to query the database to see if its 0 or 1 then if its 0 update it else just leave it? Cheers Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509142 Share on other sites More sharing options...
Yesideez Posted April 4, 2008 Share Posted April 4, 2008 Have an extra field in the database containing their user details - a boolean one called "firstvisit" for example. When they log check if this value has been set. If not set it and direct to the welcome page. If set redirect to a different page. Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509143 Share on other sites More sharing options...
Catfish Posted April 4, 2008 Share Posted April 4, 2008 May I suggest, as most people like to log the user's last login time, you could use that field in your table to see if it's their first login or not because they "last Login" would not exist on the first login. Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509149 Share on other sites More sharing options...
Ell20 Posted April 4, 2008 Author Share Posted April 4, 2008 I have set it up with an extra value in the DB which stores 0 upon registration and the redirect to the page however what dont no how to do is to set this value to 1 once they have seen it. Cheers Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509226 Share on other sites More sharing options...
Ell20 Posted April 4, 2008 Author Share Posted April 4, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509266 Share on other sites More sharing options...
haku Posted April 4, 2008 Share Posted April 4, 2008 Simple. Check to see if it is zero when they sign in, and if it is, its their first sign in. Forward them to the second page, and have that page change the value to one in the database. If the value is already one, then forward them to the other page. Link to comment https://forums.phpfreaks.com/topic/99523-solved-quick-question/#findComment-509298 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.