PDA

View Full Version : setting and retrieving cookies



bberry91
18 Nov 2010, 09:02 PM
i am trying to show that a user is/isn't logged on. here is what i have thus far:

loginsuccess.php:

<?php
$myusername = $_GET['$myusername'];
setcookie('myusername',$myusername,time() + (86400 * 7)); // 86400 = 1 day
?>

index.html:

<?php
echo 'Hello '.($_COOKIE['$myusername']!='' ? $_COOKIE['$myusername'] : 'Guest');
?>