<?php
session_start();
require_once('database-settings.php');
require_once('database.php');
require_once('library.php');

if(isset($_POST['signin'])) {
$user = trim($_POST['user']);
$pass = md5($_POST['password']);

$q = "SELECT * FROM manager_admin WHERE name ='$user' AND pwd = '$pass'";
$sry = mysql_query($q);
$result = mysql_num_rows($sry);
if( $result == 1) {

	session_regenerate_id();
	$member = mysql_fetch_array($sry);
	$_SESSION['user_cid'] = $member['cid'];
	$_SESSION['user_name_parson'] = $member['name_parson'];
	$_SESSION['user_name'] = $member['name'];
$_SESSION['user_email'] = $member['email'];
		/*$_SESSION['SESS_PHONE_NUMBER'] = $member['Phone_Number'];
	$_SESSION['SESS_HIRE_DATE'] = $member['Hire_Date'];
	$_SESSION['SESS_JOB_ID'] = $member['Job_ID'];	
	$_SESSION['SESS_SALARY'] = $member['Salary'];
	$_SESSION['SESS_DEPARTMENT_ID'] = $member['Department_ID'];
	$_SESSION['SESS_SEX'] = $member['Sex'];*/
	$_SESSION['user_role'] = $member['role'];
	$_SESSION['user_phone'] = $member['phone'];
	$_SESSION['loggedin_time'] = time();
	
	//, ,,,,,,,, ,,Password
echo '<script language ="javascript" type= "text/javascript"> alert("Welcome '.$user.' online"); location.href="index.php";</script>';}// 
	
	else {
	'<script language ="javascript" type= "text/javascript"> alert("username/password invalid"); location.href="login.php";</script>'; 


//}
}

}















?>