<?php function userLoginValidation(){ 	 	$username = $_REQUEST['username']; 	$password = md5($_REQUEST['password']); 		 	// Performing MySQL query 	$sql = "SELECT * FROM `users` WHERE `user_name` = '$username' && `password` = '$password'"; 	$row = mysql_fetch_assoc(mysql_query($sql)) or die(mysql_error()); 	$id = $row['user_id']; 	$db_username = $row['user_name']; 	$db_password = $row['password']; 	$role = $row['user_role_id']; 	 	if($username == $db_username && $password == $db_password){ 		 		session_start(); 			 		$_SESSION['user'] = $db_username; 		$_SESSION['role'] = $role; 			 		// Redirecting with header 		header('Location:cms.php'); 		exit; 				 	 }  	  	 if($username != $db_username && $password != $db_password){ 		 $_SESSION['error_msg'] = 'Invalid username and/or password'; 			 		// Redirecting with header 		header('Location:../index.php'); 		exit; 			  	 } } ?>