...

View Full Version : would session_start() be concidered the first line of code here...



DiarYofaMadmaN
05-03-2004, 09:05 PM
<? 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

missing-score
05-03-2004, 09:50 PM
Yes, it would be considered the first line of code... Assuming I get what you mean.

(just to let you know, concidered is considered :))

raf
05-03-2004, 10:22 PM
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
session_start();
if ($_SESSION['userstatus'] != 'admin') {
header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/index.php');
die();
}
?>

missing-score
05-03-2004, 10:26 PM
oops! completley missed the echo part :o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum