<?php
include('./config.php');
//protect SQL injection
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripslashes($username);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$password=hash('sha256',$password);
//SQL query that sent login info to database
$result = mysql_query ("SELECT * FROM admin WHERE Login ='$username' AND Password ='$password'",$con);
$check = mysql_num_rows ($result);
@session_start();
if ($check == 1){
while($rows = mysql_fetch_array($result)){
$_SESSION['adminID'] = $rows['ID'];
$_SESSION['username'] = $username;
header('Location: ../home.php');
}
}
else {
header('Location: ../index.php');
}
?>
Please help me take a look what's going on to .
SESSION['username'] was working fine but SESSION['adminID'] not registered..help~