I have create 6 php files which are teacher.php, student.php, login.php, logout.php, index.php, and config.php
I have done some coding and it shows out the:
username:
password
I could input my account name and password that i have registered in database.
but after I input my account name and password or wrong password or input nothing. Just press enter
it shows blank page that show nothing.
what's wrong with it, is that i miss some coding or any error?
Sorry for that because I am new on php and hope you to give me some suggestion :)
As i think the main problem is in login.php and these is the code:
<?php
include "config.php";
if(isset($_POST['log'])){
$user = $_POST['user'];
$pass = md5($_POST['pass']);
$hsl = mysql_query("select * from login where user='$user' and pass='$pass'");
$data = mysql_fetch_array($hsl);
$username = $data['user'];
$password = $data['pass'];
$type = $data['type'];
$name = $data['name'];
if($user==$username && $pass=$password){
session_start();
$_SESSION['name']=$name;
if($type=='student'){
echo "<script>location.assign('student.php')</script>";
}else if($type=='teacher'){
echo "<script>location.assign('teacher.php')</script>";
} else{
echo "<script>location.assign('wrong page.php')</script>";
}
}
}
?>