0byt3m1n1
Path:
C:
/
GEOMATICS 23-01-2021
/
LAN
/
CPMS code
/
CPMS
/
[
Home
]
File: login_ctrl.php
<?php @session_start(); require_once "lib/config.php"; require_once BASE_DIR."/model/authenticate_mdl.php"; require_once BASE_DIR."/lib/db/connection.php"; if (!isset($_POST['txtusername']) || !isset($_POST['txtpassword'])) { header("Location:index.php?status=f"); exit(); } else if ( isset($_POST['txtusername']) && isset($_POST['txtpassword'])) { if( Auth::isValidUser(@$_POST['txtusername'],@$_POST['txtpassword'])=="True" ) { @$_SESSION['username']=@$_POST['txtusername']; $u_name=@$_SESSION['username']; $sql="select user_id from user where user_name='$u_name'"; $sql=mysql_query($sql); while($row=mysql_fetch_array($sql)) { $u_id=$row[0]; } @$_SESSION['user_id']=$u_id; @$_SESSION['password']=@$_POST['txtpassword']; if(@$_SESSION['username']=="admin" || @$_SESSION['username']=="ADMIN") { header("Location:ADMIN/adminhome.php"); exit(); } else { header("Location:user/selectproject.php"); exit(); } } else if( Auth::isValidUser(@$_POST['txtusername'],@$_POST['txtpassword'])=="Invalid" ) { header("Location:index.php?status=f"); exit(); } } ?>