File "update_admin.php"
Full Path: /home/u165092617/domains/tadzz.com/public_html/admin/backend/update_admin.php
File size: 5.9 KB
MIME-type: text/x-php
Charset: utf-8
<?php session_start();
include("../../config/config.php");
include("../validateuserlogin.php");
$full_name = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'full_name']);
$email_id = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'email']);
$mobile = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'contact']);
$password = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'password']);
$username = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'username']);
$country = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'country']);
$state = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'state']);
$city = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'city']);
$copyright = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'copyright']);
$company_name = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'company_name']);
$freshdesk_url = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'freshdesk_url']);
/*file upload*/
if (!empty($_FILES[SESS_MASTER.'company_logo']['name'])){
$file_upload_flag="true";
$file_up_size=$_FILES[SESS_MASTER.'company_logo']['size'];
if ($_FILES[SESS_MASTER.'company_logo']['size']>2500000){
$msg=$msg."Your uploaded file size is more than 2500KB ";
$msg.=" so please reduce the file size and then upload.<BR>";
$file_upload_flag="false";
}
// allow only jpeg or gif files, remove this if not required //
if (!($_FILES[SESS_MASTER.'company_logo']['type'] =="image/jpeg" OR $_FILES[SESS_MASTER.'company_logo']['type'] =="image/png"))
{$msg=$msg."Your uploaded file must be of JPG or GIF. ";
$msg.="Other file types are not allowed<BR>";
$file_upload_flag="false";}
$file_name=$_FILES[SESS_MASTER.'company_logo']['name'];
$temp = explode(".", $file_name);
$newfilename = round(microtime(true)) . '.' . end($temp);
// the path with the file name where the file will be stored
$add_c=$newfilename;
if($file_upload_flag=="true"){ // checking the Flag value
if(move_uploaded_file($_FILES[SESS_MASTER.'company_logo']['tmp_name'], "../../images/web-images/logo/".$add_c)){
// do your coding here to give a thanks message or any other thing.
$msg="File successfully uploaded";
}else{
echo "Failed to upload file Contact Site admin to fix the problem";
}
}else{
$msg .= " Failed to upload file ";
}
}
/*file upload*/
/*file upload*/
if (!empty($_FILES[SESS_MASTER.'file_up']['name'])){
$file_upload_flag="true";
$file_up_size=$_FILES[SESS_MASTER.'file_up']['size'];
if ($_FILES[SESS_MASTER.'file_up']['size']>2500000){
$msg=$msg."Your uploaded file size is more than 2500KB ";
$msg.=" so please reduce the file size and then upload.<BR>";
$file_upload_flag="false";
}
// allow only jpeg or gif files, remove this if not required //
if (!($_FILES[SESS_MASTER.'file_up']['type'] =="image/jpeg" OR $_FILES[SESS_MASTER.'file_up']['type'] =="image/png"))
{$msg=$msg."Your uploaded file must be of JPG or GIF. ";
$msg.="Other file types are not allowed<BR>";
$file_upload_flag="false";}
$file_name=$_FILES[SESS_MASTER.'file_up']['name'];
$temp = explode(".", $file_name);
$newfilename = round(microtime(true)) . '.' . end($temp);
// the path with the file name where the file will be stored
$add="upload/".$newfilename;
if($file_upload_flag=="true"){ // checking the Flag value
if(move_uploaded_file($_FILES[SESS_MASTER.'file_up']['tmp_name'], $add)){
// do your coding here to give a thanks message or any other thing.
$msg="File successfully uploaded";
}else{
echo "Failed to upload file Contact Site admin to fix the problem";
}
}else{
$msg .= " Failed to upload file ";
}
}
/*file upload*/
$datecreated=date("Y-m-d H:i:s");
if($_POST OR $_FILES){
try{
$user_id=$_SESSION[ADD_TAG.'_UserId'];
$olgaquerys="UPDATE admin_master SET datecreated='$datecreated' " ;
if(!empty($full_name)){
$First_name = explode(" ", $full_name);
$_SESSION[ADD_TAG . '_FirstName'] = $First_name[0];
$olgaquerys = $olgaquerys." ,full_name='$full_name'";
}
if(!empty($username)){
$olgaquerys = $olgaquerys." ,username='$username'";
}
if(!empty($freshdesk_url)){
$olgaquerys = $olgaquerys." ,freshdesk_url='$freshdesk_url'";
}
if(!empty($email_id)){
$olgaquerys = $olgaquerys." ,emailid='$email_id'";
}
if(!empty($mobile)){
$olgaquerys = $olgaquerys." ,mobileno='$mobile'";
}
if(!empty($country)){
$olgaquerys = $olgaquerys." ,location_country='$country'";
}
if(!empty($state)){
$olgaquerys = $olgaquerys." , location_state='$state'";
}
if(!empty($city)){
$olgaquerys = $olgaquerys." , location_city='$city'";
}
if(!empty($copyright)){
$olgaquerys = $olgaquerys." , copyright='$copyright'";
}
if(!empty($company_name)){
$olgaquerys = $olgaquerys." , company_name='$company_name'";
}
if(!empty($password) && $password!=''){
$hash = password_hash($password,PASSWORD_DEFAULT);
$olgaquerys = $olgaquerys." ,userpass='$hash'";
}
if (!empty($_FILES[SESS_MASTER.'file_up']['name'])){
$olgaquerys= $olgaquerys.", profile_pic='$add' ";
}
if (!empty($_FILES[SESS_MASTER.'company_logo']['name'])){
$olgaquerys= $olgaquerys.", company_logo='$add_c' ";
}
$olgaquerys = $olgaquerys." WHERE rowId='$user_id'";
$stmts = $conn->prepare($olgaquerys);
echo $olgaquerys;
if($stmts->execute()){
header("location:../settings.php");
}
}
/*error*/
catch(PDOException $exception){
die('ERROR: ' . $exception->getMessage());
}
}
?>