Results 1 to 2 of 2

Thread: php die

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    42

    php die

    When I use this script:

    PHP Code:
    <?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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: php die

    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width