<?php
@session_start();
include("config.php");
error_reporting(0);


$vehiclenumber=$_POST['vehiclenumber']; 
$mobilenumber=$_POST['mobilenumber']; 
//$dob=$_POST['dob']; 


// To protect MySQL injection (more detail about MySQL injection)
$vehiclenumber = stripslashes($vehiclenumber);
$mobilenumber = stripslashes($mobilenumber);
//$password = mysql_real_escape_string($password);

	//$password = md5($password);

   $sql="SELECT * FROM customer WHERE vehicle_number='$vehiclenumber' AND customer_mobile='$mobilenumber'"; 
$result=mysql_query($sql);
 $row = mysql_fetch_array($result); 
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
//echo $count; exit;
if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"

$_SESSION['cusid']=stripslashes($row['id']); 
//$_SESSION['mobile']=$mobile;
$_SESSION['mobile']=$row['customer_mobile'];

$_SESSION['customername']=$row['customer_name'];  
$_SESSION['vehiclenumber']=$row['vehicle_number'];
$_SESSION['branch']=$row['branch'];



header("location:customer/index.php?flag=dn");
}
else {
header("location:index.php?flag=invalid");
exit;
}
   
?>