File: /home/barbeatleanalyti/public_html/manage.beatleanalytics.com/site/script/profile.php
<?php
class script_profile extends include_profile
{
// Mandatory variables as per requirement
var $pg = "";
var $acn = "";
// Mandatory Properties as per requirement
var $DataArr = array();
var $MandatoryFields = array("Email","Password");
var $Email = "";
var $Password = "";
var $error = "";
var $msg = "";
var $CountryID = "";
// Mandatory Method
function __CONSTRUCT($DataArr11){
if($_SERVER['HTTP_HOST'] != '192.168.2.103' && $_SERVER['HTTP_HOST'] != 'localhost' && $_SERVER['HTTP_HOST'] != 'kalpeshpc' ){
error_reporting(0);
}
global $objDB;
// here 'acn' is the variable and UserListInfo is the method name whtich is defined into controller(script) file.
$this->acn = trim(loadVariable("acn",'FetchAllUserInfo'));
// following all are the variables and its default value.
$this->pg = trim(loadVariable("pg",'profile'));
$this->Email = trim(loadVariable("Email",''));
$this->Password = trim(loadVariable("Password",''));
$this->error = trim(loadVariable("error",''));
$this->msg = trim(loadVariable("msg",''));
$this->CountryID = trim(loadVariable("CountryID",''));
// Check user login or not
$objDB->CheckUserNotLoggedIn($this->pg);
// Set all post and get variables and its value into DataArr(array)
foreach($DataArr11 as $key => $val){
if(in_array($key, $this->MandatoryFields ))
$this->DataArr[$key] = addslashes(trim($val));
}
//print_r($this->DataArr);
// set post data to main DBClass file into include
$objDB->PostData = $this->DataArr;
} ///// __CONSTRUCT completed /////
// Mandatory Method
public function Process(){
global $objDB;
// Check DoProcess method found or not into controller file.
if(!method_exists($objDB->objController,"DoProcess") ){
// Rerturn post data if method not found.
ReturnPostFormData($this->DataArr,"error.html","<span class='error-msg'> Method <strong>DoProcess</strong> does not found into <strong></strong> controler login.html file ! </span>",1);
}else{
// Call the DoProcess controller file.
$this->DoProcess();
}
} ///// Process completed /////
// Mandatory Method
private function DoProcess(){
global $objDB;
// Assing mathod name to CallMethod global variagles.
$objDB->CallMethod = $this->acn;
// Check method is exists or not into controller file.
if( method_exists($objDB->objController,$objDB->CallMethod) ){
// Server side validation for mandatory fields.
$this->ValidateFields();
// Assign the method to the local variables $CallMethod.
$CallMethod = $objDB->CallMethod;
// Call method using the local variables $CallMethod.
$this->$CallMethod();
}else{
// Return post data if mothod does not exist
ReturnPostFormData($this->DataArr,"error.html","<span class='error-msg'> Method <strong>".$objDB->CallMethod."</strong> does not found into <strong></strong> model file ! </span>",1);
exit;
}
} ///// DoProcess completed /////
// Mandatory Method
private function ValidateFields(){
$ValidateArr = array();
$ValidateArr = $this->DataArr;
// Server side validation for field is blank or not
if(!ValidateFieldBlank($ValidateArr)){
// Return post data if required field does not field.
ReturnPostFormData($ValidateArr,$this->pg.".html","Required field value should not be blank.",1);
exit;
}
} ///// ValidateFields completed /////
protected function FetchUserDataToLogin(){
global $objDB;
// Call method form the parent class.
$rsUser = parent::VerifyEmailAndPassword();
if($rsUser){
// Unset the the UserInfo session.
unset($_SESSION['UserInfo']);
// Assign the UserID into session.
$_SESSION['UserInfo']['UserID'] = $rsUser[0]['UserID'];
// Assign the workfor into session.
$_SESSION['UserInfo']['WorkFor'] = $rsUser[0]['WorkFor'];
// Return post data to user.html file
ReturnPostFormData($this->DataArr,"user.html","",0);
exit;
}else{
// Rerutn post data if email and/or password imvalid.
ReturnPostFormData($this->DataArr,$this->pg.".html","Oops..! Invalid email or passowrd, please try again. ",1);
exit;
}
} ///// FetchUserDataToLogin completed /////
public function FetchAllUserInfo(){
global $objDB;
$rsUserInfo = parent::FetchAllUserInfo();
return $rsUserInfo;
}
public function FetchAllCountryList(){
global $objDB;
$rsCountry = parent::FetchAllCountryList();
return $rsCountry;
}
public function FetchAllStateList(){
global $objDB;
$rsCountry = parent::FetchAllStateList($this->CountryID);
return $rsCountry;
}
public function FetchTimeZoneData(){
global $objDB;
$rsTimeZone = parent::FetchTimeZoneData();
return $rsTimeZone;
}
public function GetRootCategoryList(){
global $objDB;
$rsRootCat = parent::GetRootCategoryList();
return $rsRootCat;
}
public function __DESTRUCT() {
global $objDB;
unset($objDB->objController);
unset($objDB->objModel);
}
} ///// class completed /////
?>