Login pages... (quickie)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Mightywayne
Forum Contributor
Posts: 237
Joined: Sat Dec 09, 2006 6:46 am

Post by Mightywayne »

OOP...?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Object-oriented Programming.

I wouldn't attempt to jump to that until you have a decent grasp on functions first. ;)
Mightywayne
Forum Contributor
Posts: 237
Joined: Sat Dec 09, 2006 6:46 am

Post by Mightywayne »

Ew no, that means I'd have to join a team. (to get anything good)

Anyway. >>; Just thought I'd say everything's working fine now. For the most part. (but I don't want anymore help, I'm a big boi nao)

Now that I'm pretty much set up - are there any pro's or cons, to having used sessions versus cookies? Other than sessions are apparently "easier to work with"?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Mightywayne wrote:Now that I'm pretty much set up - are there any pro's or cons, to having used sessions versus cookies? Other than sessions are apparently "easier to work with"?
Cookies are bad and mean and I hate them, don't use them ... but sessions are like kitties or puppies or ... or is it cookies that are the sweetie-pies and sessions are meanies? Oh, I can't remember big boi...
(#10850)
Mightywayne
Forum Contributor
Posts: 237
Joined: Sat Dec 09, 2006 6:46 am

Post by Mightywayne »

Sorry, I was looking for useful answers, forgot to mention that.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I'm with arborint on this (see avatar).

Sessions are much more secure than cookies simply because anyone can write/modify their cookie. With sessions, since only a session identifier (session_id) is stored in a cookie, and the session information stored server side the user does not have access the data.

In a nutshell, sessions are puppies when compared to a strictly cookie based application.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Mightywayne wrote:Sorry, I was looking for useful answers, forgot to mention that.
Oh ... then neither sessions or cookies are "easier to work with." The are different systems that can be used to solve some of the same problems, yet they have their differences and peculiarities and even interrelationship. An understanding of each is fairly easy to achieve and would give you insight into where each might be appropriately appli3d.
(#10850)
Mightywayne
Forum Contributor
Posts: 237
Joined: Sat Dec 09, 2006 6:46 am

Post by Mightywayne »

After viewing this emoticon :google: I just decided to search "cookies vs. sessions".

I figured cookies was what I wanted; sessions just didn't seem right. And here it is...

http://www.hudzilla.org/phpbook/read.php/10_1_0

I'm going to look explicitly into how cookies are stored, and if there's data like...

MONEY: 243543

And they can change it to, oh

MONEY: 4273889482842

Then I of course will have to use sessions. ;) Thank you both and everyone for the help. I didn't much like sessions anyhoo. Let's see how it works with cookies. *crosses fingers*
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Mightywayne wrote:I figured cookies was what I wanted; sessions just didn't seem right. And here it is...

http://www.hudzilla.org/phpbook/read.php/10_1_0
A reasonable article except for two points where the author is erroneous. First, you can set sessions to last more than a day if you like so they can allow data to be retained longer. Conversely you can set cookies to expire after a short time if you choose.

Second, it is very easy to implement a database backend to the PHP session manager to allow multiple computers to share the same session across all of those machines (e.g. clusters). There is code to do this freely available around the net. The code is pretty simple.
(#10850)
Post Reply