Jump to content

Recommended Posts

Some login cookie questions:

 

It seems impossible to store more than 1 value in a cookie, is this correct?

So I have to make multiple cookies to store multiple values?

 

What values should I store in my cookie?

I'm making a MMORPG browser game.

I think I need player name + password, wich are both required to log in. Is this correct?

 

Is it safe to store the password in a cookie?

Should I encrypt it or not? If I encrypt it, is that safe?

Doesn't sound very safe to me either way.

Link to comment
https://forums.phpfreaks.com/topic/156596-solved-login-cookie-help/
Share on other sites

I'm also getting this weird error:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/mortalas/public_html/login.php:7) in /home/mortalas/public_html/includes/login.php on line 110

 

line 110:

setcookie("MApNumber", $number, time()+32000000);

I'm also getting this weird error:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/mortalas/public_html/login.php:7) in /home/mortalas/public_html/includes/login.php on line 110

 

line 110:

setcookie("MApNumber", $number, time()+32000000);

Can you post the lines before that?

 

Also, have you heard of SESSIONS?

there's quite a lot of code in front of it, why? what conditions should be met to be able to set a cookie?

 

yes I've heard of sessions, my site uses sessions to log in users

I want to use cookies to remember the user next time he wants to play

 

Set a cookie with a value of something like:

array('id' => 'userid', 'name' => 'username', 'status' => 'registered')

 

And anything else you need. No need to put password. You should be able to reference the user by that alone. Heck, I would set sessions with those values.

so what if some registered player looks at his cookie and replaces his number with a random other number?

 

he'll have access to the other account ...

 

my sessions use: session id, player number, player ip

 

for the cookies I just want to use the player number and password

and I want the cookie to handle the login in stead of the form so ppl don't have to log in each time they visit the site

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.