Cookie question

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

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Cookie question

Post by pinehead18 »

I'm editing some code for the first time in a while (not my code) and i'm not familar with cookies.

Code: Select all

setcookie($this->CFG['cookie']['starting_text'].'_user_name', $this->fields_arr['user_name'], time()+60*60*24*365, '/');
This is what it is.

I'm writing a news script and basically i need to see if the user is logged in (cookie is set)

So do i want to see if cfg['cookie'] is set or do you guys have any ideas?
Arawn
Forum Commoner
Posts: 42
Joined: Sat May 05, 2007 6:03 am

Post by Arawn »

That doesn't look go from a security perspective.

As to your question, check into $this->fields_arr['user_name'] which should contain the user's name but really not enough information.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You don't want to use cookies at all. At any point, a user could alter a cookie because it is on their computer, which is not at all secure. What you want are sessions.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

superdezign wrote:You don't want to use cookies at all. At any point, a user could alter a cookie because it is on their computer, which is not at all secure. What you want are sessions.
Agree... sessions are better.
Post Reply