PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am protecting some pages using session variables. When a user logs in it passes the $domain and $password. They get redirected to a folder which matches their domain. I'm trying to get the session check to work. But I'm not sure what to do.
<?php
if(!isset($_SESSION['domain'])){
echo("Need to log in first");
}else{
$msg = "You could not be logged in! Either the domain name or password did not match. Please try again!<br />";
include 'loginAgain.php';
}
?>
No matter what I try, it never lets me in the page.
do you have html before the <?php tags start? session_start() needs to be before ALL text output.. that includes any form of whitespace (outside of <?php tag blocks) and HTML or anything else that may gets sent to a user..
<?php session_start();
if(!isset($_SESSION['domain'])){
echo("Need to log in first");
}else{
$msg = "You could not be logged in! Either the username and password do not match or you have not been activated! Please try again!<br />";
include '../executions/loginAgain.php';
}
?>