Hi Everyone,
I have a question regarding when a visitor tries to log into a website. For example, if a visitor tries to input a gas price (on the below site) and if they aren't logged in, my question is - how does the website know that visitor isn't logged in as a user yet?
If I clicked on "update" under any gasoline price the website automatically takes me to a login page, how does the website know how to do that?
http://www.newjerseygasprices.com/
Thanks everyone!
Question regarding logging into a website?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Question regarding logging into a website?
It either stores a cookie in your browser that holds a value indicating whether you are logged-in, or it uses the session system that server languages have which identify unique users by their browser and IP information.
See the PHP manual: http://www.php.net/manual/en/features.sessions.php
See the PHP manual: http://www.php.net/manual/en/features.sessions.php
(#10850)
Re: Question regarding logging into a website?
This is done using what is called a "session variable" which is stored on the web server. It is often implemented using a small file stored on the visitor's computer, called a "cookie". Whenever a browser requests a web page, there is data exchanged between the browser and the server, including a very long number called the "sessionid", although this is normally never made visible to the user. But it is used in determining what is considered "a session". A session is ended when the user closes their browser or shuts down their computer, or it can be ended earlier, based on time. Look up "http session" on Google.