| Current Path : /var/www/html/mmishra/indem/pks-ec/mbaentrance/website/class/ |
| Current File : /var/www/html/mmishra/indem/pks-ec/mbaentrance/website/class/adminLogin.class.php |
<?php
$ABS_ROOT_PATH =str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']);/*
echo "<pre>";
print_r($_SERVER);*/
$arrPath = @explode("/",$_SERVER['PHP_SELF']);
#print_r($arrPath);
#echo $ABS_ROOT_PATH."".$arrPath[1]."/".$arrPath[2]."/includes/config.php";
if(in_array("website",$arrPath) )
{
$ABS_ROOT_PATH.=$arrPath[1]."/".$arrPath[2]."/".$arrPath[3];
require_once($ABS_ROOT_PATH."/includes/config.php");
}
else
{
require_once($ABS_ROOT_PATH."/includes/config.php");
}
class adminLogin extends database
{
private $userName;
private $password;
private $nor;
private $row;
private $result;
private $sql;
private $facultyId;
private $singleResult;
private $email;
//**--------------- To get post data input by administrator and make authentication -----------------**//
public function processRequest()
{
if($_POST)
{
global $THIS_MODULE_PATH;
$THIS_MODULE_PATH;
$this->userName = $_POST['userName'];
$this->password = $_POST['password'];
$this->facultyName = $_POST['facultyName'];
$this->sql="select * from tbl_register where userName='$this->userName' && password='$this->password' and status=1";
$this->result=$this->executeQuery($this->sql);
$this->nor=$this->num_rows($this->result); //exit;
if($this->nor>0)
{
$this->row=$this->fetch_rows($this->result);
$_SESSION['sess_user_id']=$this->row['0']['userId'];
$_SESSION['userName']=$this->row['0']['userName'];
//echo $this->row['0']['facultyId'];
$go="adminDesktop.php";
//$_SESSION['sessMsg'] = "You loged in successfully";
header("location: $go");
exit();
}
else
{
$go="index.php";
$_SESSION['sessMsg'] = "Wrong Username/Password.";
header("location: $go");
exit();
}
}
}
//--------------end-----------------//
//**--------------- To get post data input by administrator to edit details -----------------**//
public function editAdminDetail()
{
if($_POST)
{
global $THIS_MODULE_PATH;
$this->firstName = $_POST['firstName'];
$this->lastName = $_POST['lastName'];
$this->password = $_POST['password'];
$this->sql="update tbl_register set
firstName='$this->firstName',
lastName='$this->lastName',
password='$this->password'
where userId='$_SESSION[sess_user_id]'
";
$this->executeQuery($this->sql);
$go="adminAe.php";
$_SESSION['sessMsg'] = "User Detail Editted Successfully";
header("location: $go");
exit();
}
}
//--------------end-----------------//
//**--------------- To get admin details -----------------**//
public function getAdminDetail()
{
$this->sql="select * from tbl_register where userId='$_SESSION[sess_user_id]'";
$this->result=$this->executeQuery($this->sql);
$this->row=$this->fetch_rows($this->result);
return $this->row;
}
//--------------end-----------------//
//**--------------- To get admin password -----------------**//
/*public function adminForgptPassword()
{
global $THIS_MODULE_PATH;
if($_POST)
{
$this->userName = $_POST['userName'];
$this->sql="select * from tbl_admin where userName='$this->userName' ";
$this->result=$this->executeQuery($this->sql);
$this->nor=$this->num_rows($this->result); //exit;
if($this->nor>0)
{
$this->row=$this->fetch_rows($this->result);
$email_to=$this->row['0']['email'];
$subject="Forgot Password Mail";
$strMsg="Dear Admin,<br> Your Login Detail is as Follows:<br> Username: ".$this->row['0']['userName']." <br>Password: ".$this->row['0']['password'];
$from_email="support@studentProject.com";
$from_name="studentProject.com";
$this->send_mail($email_to,$subject,$strMsg,$from_email,$from_name,$html=true);
$go="index.php";
$_SESSION['sessMsg'] = "Your Password has been sent to Your Email Address.";
header("location: $go");
exit();
}
else
{
$go="forgotPassword.php";
$_SESSION['sessMsg'] = "Inavalid Username.";
header("location: $go");
exit();
}
}
}
//--------------end-----------------//
*/
}
?>