<?php
include("../commonpages/dbconnect.php");
if(isset($_POST['login']))
{
	 $phpemail=$_POST['email'];
	 $phppass=$_POST['password'];
	 /* Database Code */
	 
	 
 $sql="SELECT * FROM user_registration WHERE email='$phpemail' AND password='$phppass'";
	 $data=mysqli_query($con,$sql);
	 if(mysqli_num_rows($data)>0)
	 {
		 //echo 1;
		$row=mysqli_fetch_array($data);
        $id=$row['id'];	
        session_start();
		  $_SESSION['sid']=$id;
		 $_SESSION['fname']=$row['first_name'];
	   mysqli_close($con);
		#header('Location:');
		header('Location:../timeline.php');
	 }
	 else{
	header('Location:../index.php?INVALID_USERID_OR_PASSWORD');
        }
	 
		 }
else{
header('Location:../index.php?INVALID_USERID_OR_PASSWORD');
}
?>

