I wanna cookie, please.
Moderator: General Moderators
I wanna cookie, please.
Hehe I know that there are whole bunch of tutorials on cookies on stuff but I dont get them. So can someone write me a code for cookie that stores $user and $password and expires in 1 hour and code that gets $user and $password from that cookie. comments in the code are very welcomed.
Thanks for any help.
Thanks for any help.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
This is not a script-writing service, if you are looking for pre-made scripts go to http://www.hotscripts.com, if you want to pay someone to write your scripts for you go to the Jobs Forum.
Mac
Mac
At least help me understand it...
<?
//Write a cookie.php
$user_name="me";
$user_password="knocking";
$user_input="$user_name,$user_password";
setcookie("login",$user_input,time()+600);
// Cookie name "login" is dded to users computer containing "$user_input
// right?
?>
How do you get "$user_input" from that cookie?
<?
//Write a cookie.php
$user_name="me";
$user_password="knocking";
$user_input="$user_name,$user_password";
setcookie("login",$user_input,time()+600);
// Cookie name "login" is dded to users computer containing "$user_input
// right?
?>
How do you get "$user_input" from that cookie?
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
Code: Select all
$cookie_array = array(
"user" => $username,
"pass" => $password );
set_cookie("login",serialize($cookie_array),time()+600);Code: Select all
$cookie_output_array = unserialize($_COOKIEї'login']);
$username = $cookie_output_arrayї'user'];
$password = $cookie_output_arrayї'pass'];Hey
Which script wasn't working?
P.S. If you want a cookie go and buy it
P.S. If you want a cookie go and buy it
Code: Select all
їquote]$cookie_output_array = unserialize($_COOKIEї'login']);
$username = $cookie_output_arrayї'user'];
$password = $cookie_output_arrayї'pass'];ї/quote]echo $password;
Nothing happends
Have you set the cookie, "login"? And also what does $_COOKIE["login"] return?lexx wrote:echo $username;Code: Select all
cookie_output_array = unserialize($_COOKIEї'login']); $username = $cookie_output_arrayї'user']; $password = $cookie_output_arrayї'pass']
echo $password;
Nothing happends