pasan4you Posted May 18, 2014 Share Posted May 18, 2014 <?phprequire_once 'config.php'; //calls to config.php $login_username = $_POST['login_username'];//getting user name $login_password = $_POST['login_password'];//getting password $conn = new PDO('mysql:host='.DB_HOST.';port='.DB_PORT.';dbname='.DB_NAME,DB_USER,DB_PASS);//connecting to databse $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); try { $sql = 'SELECT login_username, login_password, login_group FROM login WHERE login_username=:login_username'; $stmt = $conn->prepare($sql); $stmt->execute(array(':login_username' => $login_username)); $result = $stmt->fetchAll(); if ( count($result) ) { $row = $result[0]; $_SESSION['login_username']= $row['login_username']; $_SESSION['login_group']= $row['login_group']; $_SESSION['info'][] = "Welcome to Leave Management System Of IDM University College ! "; } else { $_SESSION['info'][] = "Please check your user name and password!"; } } catch (Exception $ex) { $_SESSION['info'][] = "Login Error !"; } header("Location: ".$_SERVER['HTTP_REFERER']); ?> Link to comment Share on other sites More sharing options...
thescientist Posted May 20, 2014 Share Posted May 20, 2014 is there a question here? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now