<?php
	if(isset($_REQUEST['submit'])){
		if(($_REQUEST['username'] != "") && ($_REQUEST['password'] != "") && ($_REQUEST['role'] != "")	){
			$conn = new mysqli("localhost","root","","event");
			
			$username =$_REQUEST['username'];
			$password =$_REQUEST['password'];
			$role =$_REQUEST['role'];
			$select = "select * from signup where username ='$username' and password = '$password'  and role ='$role'";
			
			$result = mysqli_query($conn,$select);
			$rowcount = mysqli_num_rows($result);
			while($user_details = mysqli_fetch_assoc($result)){
				
				if($rowcount){
					session_start();
					$_SESSION['user_details'] = $user_details;
				
					$role1 = $user_details["role"];
					if($role1=="customer")
					{
						header('Location:wedding_plarners.php');
					}
					else{
						header('Location:admin_details.php');
					}
					
				}				
			}
			
				if($rowcount == 0){
					header('Location: event2.php');
				}	
			}
			}
		
		 else{
			header('Location: event2.php');
		}

	
	
?>