include_once "top_index.php"; if($_SESSION['user_id']<>'' && isset($_SESSION['user_id'])) { header("Location:userpanel.php?action=success"); exit(); } $action=$_REQUEST['action']; if($action=='login') { $uname=$_POST['uname']; $pass=$_POST['pass']; $query=q("select * from dt_user where user_name='".$uname."'"); $tot_rec=(int)nr($query); if($tot_rec<>0) { $fatch_user=f($query); if($fatch_user['user_active']==0) { ?> } else { if($fatch_user['password']==$pass) { q("insert into dt_log set user_id='".$fatch_user['user_id']."',login_time=now(),log_ip='".$_SERVER['REMOTE_ADDR']."'"); $inserted_id=iid(); $_SESSION['user_name']=$fatch_user['user_name']; $_SESSION['user_id']=$fatch_user['user_id']; $_SESSION['add']=$fatch_user['add']; $_SESSION['edit']=$fatch_user['edit']; $_SESSION['delete']=$fatch_user['delete']; $_SESSION['module']=$fatch_user['module']; $_SESSION['log_id']=$inserted_id; $_SESSION['branch_id']=$fatch_user['br_id']; session_write_close(); header("Location:userpanel.php?action=success"); exit(); } else { ?> } } } else { ?> } } ?>
| User Login |