Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 21st, 2003, 02:40 PM
Macinslaw Macinslaw is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Indiana
Posts: 4 Macinslaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Explode() assistance with cookies

I've been working from an article on php security using cookies. While I found the article to generally informative, it made the presumption that the individual reading the article was anything less than a knowledgeable programmer. I am a novice who is trying to learn to use good security practices from the start and need some assistance.

In the article it made reference to using cookies and imbedding information into the cookie and made a side remark about accessing that info through explode in order to continue authentication from page to page, but never delved into how this is accomplished.

Can someone please assist me in obtaining the info I need in order to continue my path?

Reply With Quote
  #2  
Old July 21st, 2003, 02:55 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
I'm no guru on this, but I'd be pretty hesitant to store session variables in a cookie. FTD got into some big trouble with that this year. I'd be more inclined to use sessions. There are sessions tutorials here and at zend.com that are pretty handy, if I remember correctly. Sessions set session cookies that expire once the browser is closed and contain a session id. The session id saved in the cookie points back to a session id associated with data stored server side, which you can then access in PHP using the $_SESSION superglobal, no exploding necessary. Dig around the articles on this site and also head over to zend.com and check out their tutorials for some helpful info on how you might approach this issue.

Reply With Quote
  #3  
Old July 23rd, 2003, 07:33 AM
Macinslaw Macinslaw is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Indiana
Posts: 4 Macinslaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
explode

Not too worried, since this is not going to be an advertised application. Though I will still take a look, but I'm not a fan of sessions. A friend also recommended them, but I like the idea of every page having to check for proper authorization and changing that auth ever 5 mins or so during the connection time. I appreciate your input however and will take your recommendation seriously as I am a novice.

Macinslaw

Reply With Quote
  #4  
Old July 23rd, 2003, 08:01 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Think of a session as a cookie stored server-side. There's no saying you can't check every page for proper authorization. I'd argue that sessions are probably safer because the server, and not the client machine, holds the data (this is particularly safe, I would imagine, if you redefine the session handler so that session data are kept in a database rather than in writable /tmp space). Anything you can do to a cookie, you can do to a session, and in fact your implementation would be very similar for each -- rather than invoking the $_COOKIE superglobal, you'd invoke $_SESSION. Go down whatever path you'd like, but I'd think that as an admitted novice, you'd do well to consider going with the as-yet uncontradicted advice of a couple of programmers who've suggested one option as more secure than another. No skin off my nose either way, though. Good luck with it.

Reply With Quote
  #5  
Old July 23rd, 2003, 03:33 PM
Macinslaw Macinslaw is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Indiana
Posts: 4 Macinslaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
enclose()

You bring a very good arguement to the table. And I would like to fully understand your method. Naturally as a novice, I am only interested in a few details:

1. Learning how to do this the right way.
2. Keeping my data safe and secure for my clients both now and in the future.
3. Learning something that can be done easily on all platforms.

If you, my senior, suggest sessions, then I am not one to argue. Please point me in the right direction so I may understand and complete my jedi training!

Thanks.

Macinslaw

Reply With Quote
  #6  
Old July 23rd, 2003, 03:53 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
I'd recommend googling for "PHP custom session handler." You're sure to find some results that'll show you how to handle your own sessions using a database. I've probably overstated my case a little. If your app passes no sensitive data along, using a cookie probably isn't the worst thing you could do. But you never want to store actual personally identifiable info or credit card numbers or unencrypted passwords, etc., in cookies. While sessions can be hijacked, if you expire them periodically and are careful about how you validate them, I think they beat cookies if only because they leave no usable information behind on the client machine. Since you said you wanted to learn to use good security practices, I thought I'd steer you away from the potentially bad path you were heading down. Of course, I'm sure there are plenty of people who would suggest that using sessions isn't a great option either. The general maxim tends to be that your security should be as strong as the data is important. That is, if nothing of any importance is going back and forth, a simple login scheme will suffice. But if you're passing banking info around, you'll want strong encryption and watertight authentication in place.

Reply With Quote
  #7  
Old July 24th, 2003, 11:04 AM
Macinslaw Macinslaw is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Indiana
Posts: 4 Macinslaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

While the work I am pursuing is semi-sensitive, to their competitors, nothing of any real value will be passed. The only items I was pacing in the cookie was a login code, randomly generated, expired and recreated every couple of minutes, and a user id.

I appreciate your information and will make an attempt to learn about sessions and the hazards of both. I'm sure that each has their merit in certain situations. I guess I just mean to say, thanks for your assistance and for giving me another option.

Macinslaw

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Explode() assistance with cookies


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway