Ok... That is not going to work. First off, you need to call session_start() before ANY output, so the <?php tag should go before the doctype. And be careful not to include any empty rows or spaces before the tag.
Secondly, $login will have no value in your code so there is no point of comparing it to anything. You should get the value from the session which you would normally store upon successful login. For example in $_SESSION['loggedIn'].
And third, I've never seen a |= operator before and can only assume it is suppose to be !=
(Forth, the @ will make sure any error that occur is ignored instead of being printed, but in a simple comparison like this there will be no errors and so the @ is not needed.)
Which gives us this:
PHP Code:
<?php session_start (); //this code checks to see if the user is logged in, if yes allowed to continue //If not redirected to the login page $login = $_SESSION['loggedIn']; // or what ever name you choose for the variable if ($login != "yes") { header ("location: http://mywebsite/login.html"); exit(); } session_destroy(); ?> <!doctype ...>
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
|