PDA

Click to See Complete Forum and Search --> : php die


casemoddertje
Jun 17th, 2005, 11:27 AM
When I use this script:

<?php
if (!isset($_COOKIE['loggedin'])) die("Welcome bezoeker! <a href=register.html>register</a> <a href=login.html >login</a>");
$mysite_username = $HTTP_COOKIE_VARS["mysite_username"];
echo "Welcome $mysite_username! <a href=logout.php>logout</a>";
?>

My page shows "welcome bezoeker" and the links but after that the whole page is gone so I think that I use it wrong is
Who know what I do wrong

CornedBee
Jun 17th, 2005, 11:41 AM
die() is to signal an error in the page. It prints the parameter and then stops script execution, which is why your page is lost.
Use normal if-else instead.

And be consistent in your usage of $_COOKIE and $HTTP_COOKIE_VARS.