Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 2nd, 2007, 12:07 PM   #1
Xeoncross
Newbie
 
Xeoncross's Avatar
 
Join Date: Aug 2006
Posts: 11
Rep Power: 0 Xeoncross is on a distinguished road
Question Session's - Is this the best way?

Ok, I am trying to make as secure of a script as I can without using SSL. I found a page on it (http://www.devarticles.com/c/a/MySQL...ssions-in-PHP/ ) and I want to know if this is right:

Say I have a user table something like like this:

CREATE TABLE users (
username varchar(255) NOT NULL,
email varchar(255) NOT NULL,
password varchar(255) NOT NULL,
sid varchar(32),
)


Every time someone logs in I create a SID value and stick one copy in the user's database table and another in a cookie to give back to the user. Then every time a page is requested I check the session ID in the cookie against the one in the database and if it is found then I let them in. Now, is there anything else that I could do to make the session ID more secure?

Should I make a new table and call it sessions and make have it contain the SID and userID?

Also, I have lots of strlen(), mysql_real_escape_string(), gettype(), etc... functions to clean the values so don't worry about that. I just want to know how to keep the user's sessionID from being hijacked by a hacker.


Thanks,
David
Xeoncross is offline   Reply With Quote
Old Feb 2nd, 2007, 12:45 PM   #2
Xeoncross
Newbie
 
Xeoncross's Avatar
 
Join Date: Aug 2006
Posts: 11
Rep Power: 0 Xeoncross is on a distinguished road
Sessions

Ok, I have found some more reading if anyone else is interested:

Store Session Data in a MySQL Database
Download Chaper 4 of phpsecurity
Trick-Out Your Session Handler
PHP 101 (part 10): A Session In The Cookie Jar
Session Handling with PHP 4

http://www.480x.com/2006/05/23/php-o...anced-servers/

Last edited by Xeoncross; Feb 2nd, 2007 at 12:47 PM. Reason: more links...
Xeoncross is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP sessions/ page refresh??? ktsirig PHP 2 Jun 1st, 2006 4:16 PM
Little help on sessions? ktsirig PHP 0 Mar 2nd, 2006 5:23 PM
PHP sessions... Where to start from? ktsirig PHP 1 Feb 27th, 2006 5:31 PM
trouble with sessions k4pil PHP 5 Nov 10th, 2005 10:42 AM
Strange PHP Sessions Errors stakeknife PHP 2 Apr 14th, 2005 7:24 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC