PDA

View Full Version : Php redirect



keyboard
06-25-2011, 07:51 AM
Hi everyone,
I am using a php cookie


<?php
if(isset($_COOKIE['lastVisit']))
$visit = $_COOKIE['lastVisit'];
else
echo "You've got some stale cookies!";

echo "Your name is ". $visit;
?>

from tizag.com. I would like to change it so that if the user does not have the cookie set they are redirected to a different page.
Any help is appreciated

fastsol1
06-25-2011, 04:05 PM
if(isset($_COOKIE['lastVisit']))
$visit = $_COOKIE['lastVisit'];
else
header('location: yourpage.php');

echo "Your name is ". $visit;