Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (36 sloc) 1.01 KB
<?php
$servername = "localhost";
$username = "root";
$password = "test";
$dbname="northwind";
// Create connection
$con = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected";
if(session_status() <> PHP_SESSION_ACTIVE){
session_start();
}
//If not logged in, redirect to login page
$loggedIn = false;
if(isset($_SESSION["CustomerID"])){
if ($_SESSION["CustomerID"] != -1){
$loggedIn = true;
}
}
if(isset($_SESSION["EmployeeID"])){
if ($_SESSION["EmployeeID"] != -1){
$loggedIn = true;
}
}
if(isset($_SESSION["AdminID"])){
if ($_SESSION["AdminID"] != -1){
$loggedIn = true;
}
}
if (!$loggedIn && !isset($loggingIn)){
header("Location:login.php?message=invalid");
}
?>
You can’t perform that action at this time.