[PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Jason Pruim
Hi Everyone, I'm attempting to figure out the proper way to use sessions to log someone into my system. The idea being, if they arn't logged in all they can see is the login form, and if they are logged in, they and have access to a database of addresses. I think I understand how to start

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Daniel Brown
On 8/24/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I'm attempting to figure out the proper way to use sessions to log > someone into my system. The idea being, if they arn't logged in all > they can see is the login form, and if they are logged in, they and > have access to a dat

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Borokov Smith
Daniel Brown schreef: Keep in mind that, as always, this hasn't been bug-checked, re-read, or otherwise validated. A warrant about your example not being validated, will most likely not stop the OP from using this code as is, thereby subjecting himself to SQL injection. And all it nee

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Daniel Brown
On 8/24/07, Borokov Smith <[EMAIL PROTECTED]> wrote: [snip] > A warrant about your example not being validated, will most likely not > stop the OP from using this code as is, thereby subjecting himself to > SQL injection. > And all it needed was mysql_real_escape_string() in there. > > Kinda' like

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Borokov Smith
Daniel Brown schreef: On 8/24/07, Borokov Smith <[EMAIL PROTECTED]> wrote: [snip] A warrant about your example not being validated, will most likely not stop the OP from using this code as is, thereby subjecting himself to SQL injection. And all it needed was mysql_real_escape_string() in the

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-24 Thread Daniel Brown
On 8/24/07, Borokov Smith <[EMAIL PROTECTED]> wrote: > Daniel Brown schreef: > > On 8/24/07, Borokov Smith <[EMAIL PROTECTED]> wrote: > > [snip] > > > >> A warrant about your example not being validated, will most likely not > >> stop the OP from using this code as is, thereby subjecting himself to

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-26 Thread Richard Lynch
On Fri, August 24, 2007 11:03 am, Jason Pruim wrote: > Hi Everyone, > > I'm attempting to figure out the proper way to use sessions to log > someone into my system. The idea being, if they arn't logged in all > they can see is the login form, and if they are logged in, they and > have access to a d

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Jason Pruim
On Aug 24, 2007, at 12:15 PM, Daniel Brown wrote: On 8/24/07, Jason Pruim <[EMAIL PROTECTED]> wrote: Hi Everyone, I'm attempting to figure out the proper way to use sessions to log someone into my system. The idea being, if they arn't logged in all they can see is the login form, and if they

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Daniel Brown
On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > > On Aug 28, 2007, at 10:03 AM, Daniel Brown wrote: > > > On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > > [snip] > >>> $sql = "SELECT * FROM users WHERE user='".$user."' AND > >>> pass='".$pass."' LIMIT 0,1;"; > >>> $result

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Jason Pruim
On Aug 28, 2007, at 10:03 AM, Daniel Brown wrote: On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: [snip] $sql = "SELECT * FROM users WHERE user='".$user."' AND pass='".$pass."' LIMIT 0,1;"; $result = mysql_query($sql) or die("Wrong data supplied or database error");

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Daniel Brown
On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: [snip] > > $sql = "SELECT * FROM users WHERE user='".$user."' AND > > pass='".$pass."' LIMIT 0,1;"; > > $result = mysql_query($sql) or die("Wrong data supplied or > > database error"); > > while($row = mysql_fetch_array($res

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Jason Pruim
On Aug 28, 2007, at 10:21 AM, Daniel Brown wrote: On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: On Aug 28, 2007, at 10:03 AM, Daniel Brown wrote: On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: [snip] $sql = "SELECT * FROM users WHERE user='".$user."' AND pass='".$pass."' L

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Stut
Jason Pruim wrote: One other question, to logout, can I just call a file that has session_destroy() and a header("Location: ???"); in it? Or should I do something else for logging out? foreach (array_keys($_SESSION) as $key) unset($_SESSION[$key]; session_destroy(); -Stut -- http://stut.

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-28 Thread Daniel Brown
On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > > On Aug 28, 2007, at 10:21 AM, Daniel Brown wrote: > > > On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > >> > >> On Aug 28, 2007, at 10:03 AM, Daniel Brown wrote: > >> > >>> On 8/28/07, Jason Pruim <[EMAIL PROTECTED]> wrote: > >>> [snip] >

RE: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-29 Thread Ford, Mike
On 28 August 2007 15:56, Stut wrote: > Jason Pruim wrote: > > One other question, to logout, can I just call a file that has > > session_destroy() and a header("Location: ???"); in it? Or should I > > do something else for logging out? > > foreach (array_keys($_SESSION) as $key) > unset($_SE

Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-29 Thread Richard Heyes
Ford, Mike wrote: > On 28 August 2007 15:56, Stut wrote: > >> Jason Pruim wrote: >>> One other question, to logout, can I just call a file that has >>> session_destroy() and a header("Location: ???"); in it? Or should I >>> do something else for logging out? >> foreach (array_keys($_SESSION) as $k