File: /home/barbeatleanalyti/public_html/barisnew.beatleanalytics.com/site/backup/script/profileemp.php
<?php
class script_profileemp extends include_profileemp
{
// Mandatory variables as per requirement
var $pg = "";
var $acn = "";
var $v = "";
// Mandatory Properties as per requirement
var $DataArr = array();
var $error = "";
var $msg = "";
var $loginArr = array("login","logout");
var $MandatoryFields = array("profileimage");
var $ErrorDoc = "";
var $vArr = array("list","editable");
var $profileimage = "";
var $back = "";
// 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",'profileemp'));
$this->error = trim(loadVariable("error",''));
$this->msg = trim(loadVariable("msg",''));
$this->v = trim(loadVariable("v",'list'));
$this->back = trim(loadVariable("back",'tab_1'));
$this->profileimage = trim(loadVariable("profileimage",""));
if( !in_array(strtolower($this->v),$this->vArr) ){
// Return post if v's value does nto found into array
ReturnPostFormData(array(),"error.html","<span class='error-msg'>v's value does not found in <strong>".$this->pg."</strong> file !</span>",1);
exit;
}
// Check user login or not
$this->CheckMasterAdminLoggedInOrNot($this->pg);
// Login varibal for login or logout value
$this->login = trim(loadVariable("login",''));
// Check user login or not
$this->CheckDashboardAdminLoggedInOrNot($this->pg);
if( isset($this->login) && $this->login != "" ){
if(!in_array($this->login,$this->loginArr)){
ReturnPostFormData($this->DataArr,"dashboardemp.html","Login value should not be matched, please try again ! ",1);
exit;
}
}
// 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));
}
// 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 CheckDashboardAdminLoggedInOrNot($pg){
// Check user login or not;
if(!isset($_SESSION['UserInfo']) || count($_SESSION['UserInfo']) != 4 || !isset($_SESSION['UserInfo']['SessionID']) || $_SESSION['UserInfo']['SessionID'] != session_id())
{
?>
<script>
window.location.href = 'https://beatleanalytics.com';
</script>
<?php
}
//print_r($this->objMain);
}
protected function CheckMasterAdminLoggedInOrNot($pg){
// Check user login or not;
if(!isset($_SESSION['UserInfo']) || count($_SESSION['UserInfo']) != 4 || !isset($_SESSION['UserInfo']['SessionID']) || $_SESSION['UserInfo']['SessionID'] != session_id())
{
?>
<script>
alert('Oops..! Here is something wrong, please try again with proper credentails.');
window.location.href = 'https://beatleanalytics.com/'
</script>
<?php
}
}
public function uploadprofileimage(){
if($this->currentpage != ""){
$this->pg = $this->currentpage;
}
// if($_FILES['profileimage']['name'] == ""){
// ReturnPostFormData($ValidateArr,$this->pg.".html","Required field value should not be blank.",1);
// exit;
// }
$upload = parent::UploadUserProfileImage();
// if($this->ErrorDoc != ""){
// ReturnPostFormData($this->DataArr,$this->pg.".html",$this->ErrorDoc,1);
// exit;
// }
if($upload){
ReturnPostFormData($this->DataArr,"profileemp.html","Profile image uploaded successfully.",0);
exit;
}else{
ReturnPostFormData($this->DataArr,"profileemp.html","There is something wrong to upload profile image.",1);
exit;
}
}
public function removeprofileimage(){
$remove = parent::removeprofileimage();
if($remove){
ReturnPostFormData($this->DataArr,"profileemp.html","Profile image removed successfully.",0);
exit;
}else{
ReturnPostFormData($this->DataArr,"profileemp.html","There is something wrong to upload profile image.",1);
exit;
}
}
public function FetchAllUserInfo(){
global $objDB;
$rsUserInfo = parent::FetchAllUserInfo();
return $rsUserInfo;
}
} ///// class completed /////
?>