Hi all,
I want to validate username and password in the same page where login form exists. I have this coding and if username and password not matches it redirects to "try_again.php" page. Instead of that i want to show the validation ( "Invalid username or password") in the same page. If username matches to its password it should be redirected to other relevant page.
<?php
$db=mysql_connect('localhost','root','');
mysql_select_db('bank');
$username= $_POST['username'];
$password= $_POST['password'];
$password=md5($password);
$result = mysql_query ("select* from users
where username='$username' and password='$password'",$db);
while($row=mysql_fetch_row($result)){
$user_type=$row[5];
}
session_start();
session_register("user_type");
$_SESSION["user_type"]=$user_type;
if($user_type=='T'){
header('Location:teller_page.php');
}else if($user_type=='AO'){
header('Location:accofficer_page.php');
}else if($user_type=='AS'){
header('Location:accsup_page.php');
}else if($user_type=='LS'){
header('Location:loansup_page.php');
}else if($user_type=='CS'){
header('Location:cashsup_page.php');
}else if($user_type=='GM'){
header('Location:manager_page.php');
}else if($user_type=='MBSL'){
header('Location:welcome.php');
}else if($user_type=='CML'){
header('Location:reports.php');
[B]}else{
header('Location:try_again.php');
}
[/B]
?>