Question:
Check that user has logged in?
anonymous
2008-05-18 19:59:05 UTC
I have a simple php login file that just checks that the user has entered the correct username and password from an array of usernames and passwords. Once they login correctly it redirects them to a new site. But the problem is that site can easily be accessed if it is just typed into the url. How do you make a script that checks the user has logged in?
Four answers:
youngboy1606
2008-05-18 20:05:16 UTC
Check to see if the logged in in the Form Load event of your page.



If their not then redirect them to the login page.
anonymous
2008-05-18 20:31:45 UTC
Set a session variable on login. In the page they're redirected to after login, check the session variable. If it's not correct, immediately redirect them to the login page.
catbertnc
2008-05-18 20:15:28 UTC
Try this. When a user successfully logs in, the script creates a cookie on their computer. When a user visits pages after logging in, each of those pages checks to see if the cookie exists. If it does, allow them to view the page. If not, redirect them to the log-in page. And of course, when the user logs out, that script deletes the cookie.
blye
2016-12-06 19:35:56 UTC
the assumption is too uncomplicated: once you go surfing you deliver a request to MySqol to make sure if the username and password are available opt for between table …….. the position username = $.. and pw=$…. accordingly we've 2 possibilities a million- the password and consumer call are available ( reroute the consumer to particular web page ) 2- the password and username aren't any more accessible ( reroute the consumer to blunders web page)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...