<?php

ob_start();
session_start();

include("config.php");

if(isset($_POST['submit'])!= '')
{ 

	
$mobile= mysqli_real_escape_string($com,$_POST['mobile']);
$password=mysqli_real_escape_string($com,md5($_POST['password']));


$sql="select * from loginuser where mobile='$mobile' and password='$password'";
//print_r($sql);exit;
	$result=mysqli_query($com,$sql);
	$num=mysqli_num_rows($result);
	
	$line=mysqli_fetch_array($result);
	

	if($num>=1)
	{
		
		$userid=$line['id'] ;
		$_SESSION['frontuserid']=$userid;
		$_SESSION['mobile']=$line['mobile'];
		$_SESSION['password']=$line['show_password'];
		
		echo "<script type='text/javascript'>alert('Login Success'); window.location='index.php';</script>";
		
		
	}else{
	   	echo "<script type='text/javascript'>alert('Please Enter Right Mobile and Password'); window.location='login.php';</script>"; 
	}
	


}



?>