Thank you so much!
Yeah, i'm unfortunately terribly noob :/
Just to clarify:
In the base.php i should start my session so the variables are open, correct?
So something like this:
<?php
session_start();
if(!isset($_SESSION))
{
session_id();
$_SESSION['username']= "";
$_SESSION['LoggedIn'] = false;
$_SESSION['userID']= "";
$_SESSION['userType'] = "";
}
$dbhost = "localhost"; // this will ususally be 'localhost', but can sometimes differ
$dbname = "aa2"; // the name of the database that you are going to use for this project
$dbuser = "root"; // the username that you created, or were given, to access your database
$dbpass = ""; // the password that you created, or were given, to access your database
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
?>
and checking the variable i should always use === or is it situational?
Just to make sure i'm kinda grasping it:
if($_SESSION['LoggedIn'] === true)
{
}else{
echo "click <a href = ../index.php> here </a> to login";
}
if($_SESSION['userType'] == "admin")
{
echo "You're logged in as an admin";
}else
{
}
As the 'userType' is a word i'm using == and the LoggedIn is a boolean so i'm using ===
Correct?
Thanks again!