cookie

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
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

cookie

Post by ddragas »

I have problems with cookies.

to set up cookie I use this and it works

Code: Select all

<?php
$expires_soon = date("l, d-M-y H:i:s", time() + 54000);
setcookie( "email=$email;  expires=$expires_soon;");
setcookie( "lozinka=$lozinka;  expires=$expires_soon;");
?>
how to read from cookie?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

print_r($_COOKIE)
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Thank you for reply, And how to put retrived data from cookie to variable?

I've set in coockie values of email and password.

example

$email=email from cookie
$password=password from cookie

with print_r($_COOKIE) i get all values from cookie
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<?php

$email = $_COOKIE['email'];
$password = $_COOKIE['password'];

?>
or whatever names you give each cookie...
Post Reply