Why does this not redirect users to another site?
<?php
$uname=htmlspecialchars($_POST['drivername']);
$pword=htmlspecialchars($_POST['driverpassword']);
$user_name='nreddin';
$password='';
$database='rides';
$server='localhost';
$conn=mysql_connect($server,$user_name);
if(!$conn){
die('No connect:'.mysql_error());
}
else{
print"connected to server<br>";
} //good so far
$db=mysql_select_db($database, $conn);
if(!$db){
die('Database not found:'.mysql_error());
}
else{
print"connected to database<br>";
$SQL="SELECT*FROM login WHERE L1='$uname' AND L2='$pword' " ;
if(!$SQL){
die("Table not found".mysql_error());
}
else{
print("Tabvle Selected");
}
$result=mysql_query($SQL);
if(!$result){
print(mysql_error()."<br> Improper Username and/ or Password! * NOTE all Characters are CaseSensitive*");
}
else{
//print("fidskfj"); trouble shooting works this far with proper syntax closure
$num_rows=mysql_num_rows($result);
if($num_rows==1){
session_start();
$_SESSION['authenticated']="1";
if(!(header("location:http://localhost:8888/welcomepg.htm"))){
print(mysql_error());}
else{print('header');}
}
else{
$errorMessage='Invalid Login';
session_start();
$_SESSION['authenticated']='';
}
}
}
print($num_rows);
// it knows it is logged in; Session start fucking it up//
?>
The print num_rows was put there at the end just to help troubleshoot.
The whole thing is a bit messy... sorry
ANy help is appreciated...
Bookmarks