Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Website Design/Showcase (http://www.chiefdelphi.com/forums/forumdisplay.php?f=64)
-   -   Logging into ChiefDelphi.com question (http://www.chiefdelphi.com/forums/showthread.php?t=28794)

Raven_Writer 27-05-2004 18:16

Logging into ChiefDelphi.com question
 
Does anyone know how the message board keeps the username logged in after registering, so that the user doesn't have to log in again? I'm asking this because for my PHP script I'm working on, I want the user to not have re-login everytime, or atleast after s/he gets done registering.

Elgin Clock 27-05-2004 18:45

Re: Logging into ChiefDelphi.com question
 
Cookies?

Guest 27-05-2004 19:23

Re: Logging into ChiefDelphi.com question
 
Use the following code at the top of each page:
PHP Code:

session_start(); 

Now use the Session variables to check if a user is logged in.

Ryan M. 27-05-2004 19:26

Re: Logging into ChiefDelphi.com question
 
Quote:

Originally Posted by Elgin Clock
Cookies?

I think so. It uses a session cookie by default, but when you check the "Remember me" box it uses the, uh, "long-term" cookie. (don't know the technical term... :))

Pierson 27-05-2004 19:30

Re: Logging into ChiefDelphi.com question
 
I believe it is cookies because whenever I clear my cookies, I have to log in again. (/me defers to Brandon for the final answer)

However with other sites, like amazon.com they track you through the web address itself. But this only works for one session at a time.

Raven_Writer 27-05-2004 20:25

Re: Logging into ChiefDelphi.com question
 
Thank you all very much. I had a feeling it was through cookies (my other theory was very terrible). Off to learn about PHP and cookies.

evulish 27-05-2004 21:33

Re: Logging into ChiefDelphi.com question
 
If what you're doing is trying to do a log-in system, don't depend on the cookie information to be sent from you. People can write their own cookies. Say there were two users.. billybob and jimmyjoe. If billybob signs in, and you set a cookie to 'user=billybob,' jimmyjoe could come along and write his own cookie that says 'user=billybob' allowing him to bypass any password. A common plan is to assign a user-id string when the person logs in. Store it in a database along with the rest of the users information and in his cookie. Then when he accesses the page again, check the database for that unique id. It's not super-ultra-mega secure. But it's exponentially better than using the login name as the method to check. Hope that helps, or even relates to what you're trying to do :P (Maybe it'll help some other random soul.. *shrug*)

Raven_Writer 30-05-2004 09:27

Re: Logging into ChiefDelphi.com question
 
Quote:

Originally Posted by evulish
If what you're doing is trying to do a log-in system, don't depend on the cookie information to be sent from you. People can write their own cookies. Say there were two users.. billybob and jimmyjoe. If billybob signs in, and you set a cookie to 'user=billybob,' jimmyjoe could come along and write his own cookie that says 'user=billybob' allowing him to bypass any password. A common plan is to assign a user-id string when the person logs in. Store it in a database along with the rest of the users information and in his cookie. Then when he accesses the page again, check the database for that unique id. It's not super-ultra-mega secure. But it's exponentially better than using the login name as the method to check. Hope that helps, or even relates to what you're trying to do :P (Maybe it'll help some other random soul.. *shrug*)

I was reading about how bad cookies were usually past couple of days. Now, I've switched over to using sessions. I think I'll either try storing a unique ID (MD5 maybe?), or just not even bother keeping the user logged in during a re-visit.

Brandon Martus 30-05-2004 11:44

Re: Logging into ChiefDelphi.com question
 
There are a few cookies that keep you logged in. You could, rather than use cookies, send the session ID through the URL. That is what vBulletin does if you don't allow cookies to be used, and have that setting configured in your options.


All times are GMT -5. The time now is 06:57.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi