Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    would session_start() be concidered the first line of code here...

    PHP Code:
    <? session_start(); ?>
    <?php 
        
    //session_start();
        
    if (($_SESSION['userstatus'] != 'admin')) {
            echo 
    'Please login by pressing <a href="login.php">here</a>';
            
    header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/index.php');
            die();
        }
    ?>
    Would that session_start(); be concidered the first line of code(it's all the way at the top) if i then did the following next lines of coding?

    -Thanks

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it would be considered the first line of code... Assuming I get what you mean.

    (just to let you know, concidered is considered )

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I suppose this is some sequal to http://www.codingforums.com/showthread.php?t=37932

    Nut it wount work because of the echo ---> before redirecting (the header()) there should be NO OUPUT sent to the client. Your code shoudl be what i posted before
    PHP Code:
    <?php  
    session_start
    (); 
    if (
    $_SESSION['userstatus'] != 'admin') {
          
    header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/index.php'); 
            die(); 

    ?>
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oops! completley missed the echo part


  •  

    Posting Permissions

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