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 Quote Link to comment 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! Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Ell20 Posted April 4, 2008 Author Share Posted April 4, 2008 Anyone? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.