Jump to content

Cookie Problems


PC Nerd

Recommended Posts

hi guys.

 

im setting cookies for my login and instead of storing the values i want it to, its storing a timestamp instead

 

my code is in a few pages, althoug ill summerise my data, and only post the code that creates the cookies:

 

 




$User_Name = $_POST['User_Name'];
$User_ID = $Login['User_ID'];
$Login_ID = $Login['Login_ID'];
#$Logged_In = "YES";
#$Active = "Yes";

setcookie("User_Name", $User_Name, strtotime('+ 30 minutes'));
setcookie("Login_ID", $Login_ID, strtotime('+ 30 minutes'));
setcookie("User_ID", $User_ID, strtotime('+ 30 minutes'));


 

$Login is an array storing values retreive from the database.  when loging in.  it saves your login, time, user id to a table.  $Login_Array is simply retreiving this record again, so that the Auto_increment field "login_ID" can be stored in the cookie.  $DB_Login is a returned test to check whether or not the user_Name entered is even in the database.....  $_POST['User_Name'] is the User_Name entered by the user to login.  now my cookies are saving the following data, and theres still a "phanton" cookie that i used to use to have the expire time to check wherer or not their logged in....  The cookies are:

 

 

User_Name => 1176012801

Logged_In => 1176012801

Login_ID => 1176012801

User_ID => 1176012801

 

 

these change everytime that the user logs in....... and gets deleted when the user logs out.....

 

 

also, when i veiw the cookies on the page where they are created...... they are there, but i  know that you shouldnt be able to veiw a cookoie on the page where its created....

 

 

i would really appreciate anyoes help in this problem, its been really annoying me for a few days now.

 

thanks,

PC Nerd

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/
Share on other sites

what I did wasnt 100% what you're trying, i was trying to use it for a shoutbox so the users didn't have to enter their nick and website everytime... when i come to think about it i gave the whole thing up, so they just have to write it now..hehe... but what i tried was

 

1) Setting the setcookie() inside an if statement (heard from someone on the forum that it might help)

2) i tried using variables, $_REQUEST, $_POST

 

and something else, but i dont remember all of it..

 

btw... u dont have to use [NOR] =) that's just where i'm from

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/#findComment-224858
Share on other sites

hmm... only thing I can come up with now... after beeing up all night is FFD...hehe.. but that's not an option i guess =) how many users are you planning to be able to handle? unlimited? cuz ... if you dont have to many you could maybe make a folder called users or something, and have a file with the users username as filename .. haha... nah...forget it... that was a really retarded idea...haha ;D

 

 

*EDIT*

 

About that backdoor... make a flatfile for admins and one for moderators... wow... i think that was a pretty good idea  ;D ;D ;D

 

btw... have you tried:

$User_Name = $_POST['User_Name'];
$User_ID = $Login['User_ID'];
$Login_ID = $Login['Login_ID'];
#$Logged_In = "YES";
#$Active = "Yes";
if (isset($User_name)) {
setcookie("User_Name", $User_Name, strtotime('+ 30 minutes'));
setcookie("Login_ID", $Login_ID, strtotime('+ 30 minutes'));
setcookie("User_ID", $User_ID, strtotime('+ 30 minutes'));
}

or something simular?

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/#findComment-224870
Share on other sites

um, FFD ????? Flat file Database?

 

 

its definately got to be a proper database, im looking at hundreds of people, A DAY!!!!! and new ones signing up.  its a game called battle-ages ( http://www.battleages.tk)  and its almost ready to release ( excuse the site, its slightly out of date and very primitive) but the games a lot better.

 

the backdoor i was tlking about is more of an option for Mods and Admin, that doesnt require them to login....... to an extent ( ie relogin every 30 min lke everyone else........) but thatll come later i think

 

how much better would sessions be?????.  i would prefer cookies

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/#findComment-224885
Share on other sites

dunno... but i if i was you I would delete all cookies and try again... just to see.. sometimes cookies mess up things really bad...

 

the gaming clan i'm in, when we moved from windows to linux servers, even when everything on the site was removed, the cookies made it so I still got the old site up.. but when i deleted all cookies everything was back the way it should have been in the first place =)

 

so it's worth a try...

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/#findComment-224931
Share on other sites

ok.....

 

i deleted all cookies, and it didnt work.....

 

then i restarted computer, and there were no cookies

 

i logged in again and the cookoies were back, still sith the timestamp........

 

now are cookies in IE7 saved in the Temporary internet files folder, or somewhere else?

 

 

 

thankx

 

Link to comment
https://forums.phpfreaks.com/topic/46237-cookie-problems/#findComment-224944
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.