403Webshell
Server IP : 208.122.213.31  /  Your IP : 216.73.216.45
Web Server : Apache
System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64
User : WHMCS_MIA_382 ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/httpd/html/members.playwithrae.com/public_html/custom_assets/options/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/httpd/html/members.playwithrae.com/public_html/custom_assets/options/includes/functions.php
<?php
define("ZD03VERSION", "1.1.0" );
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);

//Lets define the ABSOLUTE PATH set as a CONSTANT
$explode_abs_path = explode('/', realpath(dirname(__FILE__)) );
$sizeof_abs_path = sizeof($explode_abs_path);
$output_abs_path = array_slice($explode_abs_path, 0, $sizeof_abs_path-2);
$implode_abs_path = implode('/', $output_abs_path);
define("ABSPATH", $implode_abs_path);

//Lets define the URL set as a CONSTANT
if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){ $http = 'https://'; } else { $http = 'http://'; }
$actual_link = $http.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$explode_actual_link = explode('/', $actual_link );
$sizeof_actual_link = sizeof($explode_actual_link);
$output_actual_link = array_slice($explode_actual_link, 0, $sizeof_actual_link-3);
$implode_actual_link = implode('/', $output_actual_link);
define("TOURURL", $implode_actual_link);

//Include the CONFIG file:
require(ABSPATH.'/options/config.ini.php');
define("CONFIGS", serialize( $zdopt ) );

//Main Functions
function get_header($pagename){
	if(!isset($_SESSION['pagename'])) { $_SESSION['pagename'] = ''; } else { $_SESSION['pagename'] = $pagename; }
	if(isset($_SESSION['pagename'])) { $_SESSION['pagename'] = $pagename; }
	include('_header.php');
}//get_header

function get_footer(){
	include('_footer.php');
}//get_footer

function get_navbar($pagename){
	if(!isset($_SESSION['pagename'])) { $_SESSION['pagename'] = ''; } else { $_SESSION['pagename'] = $pagename; }
	if(isset($_SESSION['pagename'])) { $_SESSION['pagename'] = $pagename; }
	include('_navbar.php');
}//get_navbar

function checkLogin($pagename){
	if( $pagename != 'login' ){
		if( isset($_SESSION['login_valid']) ){
			if($_SESSION['login_valid'] == true) { $login_accepted = true; }
			else { $login_accepted = false; }
		} else {
			$_SESSION['login_valid'] = false;
			header('Location: index.php?msg=restricted');
		}
	}
}//checkLogin

function checkPermissions(){
	if( is_writable( ABSPATH.'/options/config.ini.php' ) ){ $file_ok = true; } else { $file_ok = false; }
	if( is_writable( ABSPATH.'/uploads/' ) ){ $folder_ok = true; } else { $folder_ok = false; }
	
	if( $file_ok && $folder_ok ){
		echo '
		<div class="alert alert-success">
			<h4><strong>File/Folder Permissions</strong> OK!</h4>
			<p><i class="fa fa-check"></i> .../custom_assets/options/config.ini.php - permissions correct (file is writable)</p>
			<p><i class="fa fa-check"></i> .../custom_assets/uploads/ - permissions correct (folder is writable)</p>
		</div>';
	} else {
		echo '
		<div class="alert alert-danger">
			<h4><strong>File/Folder Permissions</strong> errors! Please fix.</h4>';
			if($file_ok){
				echo '<p><i class="fa fa-check"></i> .../custom_assets/options/config.ini.php - permissions correct (file is writable)</p>';
			} else {
				echo '<p><i class="fa fa-times"></i> .../custom_assets/options/config.ini.php - incorrect/non-writable permissions, please set CHMOD to, at least, 666</p>';
			}
			
			if($folder_ok){
				echo '<p><i class="fa fa-check"></i> .../custom_assets/uploads/ - permissions correct (folder is writable)</p>';
			} else {
				echo '<p><i class="fa fa-times"></i> .../custom_assets/uploads/ - incorrect/non-writable permissions, please set CHMOD to, at least, 777</p>';
			}
		echo '</div>';
	}
}//checkPermissions

function checkDatabase(){
	$zdopt = unserialize(CONFIGS);
	
	$msg_class = '';
	$msg_title = '';
	$msg_body = '';

	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		$msg_title = 'Database Connection Errors!';
		$msg_class = 'alert-danger';
		$msg_body .= '<p><i class="fa fa-times"></i> Unable to connect to the database, please check the settings below!!!</p>';
	} else {
		$msg_title = 'Connected to the Database!';
		$msg_class = 'alert-success';
		$msg_body .= '<p><i class="fa fa-check"></i> Successfuly connected to the database!</p>';
		mysqli_set_charset($link, 'utf8');
		
		//Check is the custom TABLE _zd_theme_options_SITEID_SUBSITEID exists:
		$custom_options_table = '_zd_theme_options_'.$zdopt['evx_siteid'].'_'.$zdopt['evx_subsiteid'];
		$sql_exists = "DESCRIBE `$custom_options_table`";
		if( mysqli_query($link, $sql_exists) ){
			$msg_body .= '<p><i class="fa fa-check"></i> You already have the `'.$custom_options_table.'` table setup in the database!</p>';
		} else {
			$msg_body .= '<p><i class="fa fa-times"></i> Please setup the `'.$custom_options_table.'` table here: <a href="dashboard.php?action=setup_tables&table_name='.$custom_options_table.'" class="btn btn-success btn-sm">SETUP OPTIONS TABLE</a><br/>Make sure <strong>SITE ID</strong> and <strong>SUBSITE ID(optional)</strong> are filled out below.</p>';
		}
		
		mysqli_close($link);
	}
	
	if (function_exists('mysqli_connect')) {
		//mysqli is installed, all good!
		$msg_body .= '<p><i class="fa fa-check"></i> mysqli module installed!</p>';
	} else {
		$msg_body .= '<p><i class="fa fa-time"></i> Please have your host istall the <strong>mysqli module</strong>. Without it, the template will not work.</p>';
	}
	
	echo '
	<div class="alert '.$msg_class.'">
		<h4>'.$msg_title.'</h4>
		'.$msg_body.'
	</div>';
}//checkDatabase

function setupDatabaseTable( $table_name ){
	$zdopt = unserialize(CONFIGS);
	
	$msg_class = '';
	$msg_title = '';
	$msg_body = '';

	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		$msg_title = 'Database Connection Errors!';
		$msg_class = 'alert-danger';
		$msg_body .= '<p><i class="fa fa-times"></i> Unable to connect to the database, please check the settings below!!!</p>';
	} else {
		$msg_title = 'Database updated successfuly!';
		$msg_class = 'alert-success';
		$msg_body .= '<p><i class="fa fa-check"></i> Setting up the `'.$table_name.'` table...</p>';
		mysqli_set_charset($link, 'utf8');
		
		//DROP AND INSERT TABLE
		$sql_drop_table = "DROP TABLE IF EXISTS `$table_name`;";
		if( mysqli_query($link, $sql_drop_table) ){
			$msg_body .= '<p><i class="fa fa-check"></i> <strong>`'.$table_name.'` REMOVED!</strong></p>';
		} else {
			$msg_body .= '<p><i class="fa fa-times"></i> <strong>`'.$table_name.'` NOT REMOVED!</strong></p>';
			$msg_body .= '<p><i class="fa fa-times"></i> '.$link->error.'</p>';
		}
		
		$sql_insert_table = "CREATE TABLE `$table_name` (`Name` text NOT NULL, `Value` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
		if( mysqli_query($link, $sql_insert_table) ){
			$msg_body .= '<p><i class="fa fa-check"></i> <strong>`'.$table_name.'` CREATED!</strong></p>';
		} else {
			$msg_body .= '<p><i class="fa fa-times"></i> <strong>`'.$table_name.'` NOT ADDED!</strong></p>';
			$msg_body .= '<p><i class="fa fa-times"></i> '.$link->error.'</p>';
		}
		
		$sql_insert_op1 = "INSERT INTO `$table_name` (Name, Value) VALUES ('THEME_OPTIONS', '')";
		if( mysqli_query($link, $sql_insert_op1) ){
			$msg_body .= '<p><i class="fa fa-check"></i> <strong>`THEME_OPTIONS` Row added!</strong></p>';
		} else {
			$msg_body .= '<p><i class="fa fa-times"></i> <strong>`THEME_OPTIONS` Failed!</strong></p>';
			$msg_body .= '<p><i class="fa fa-times"></i> '.$link->error.'</p>';
		}
		
		$sql_insert_op2 = "INSERT INTO `$table_name` (Name, Value) VALUES ('HERO_OPTIONS', '')";
		if( mysqli_query($link, $sql_insert_op2) ){
			$msg_body .= '<p><i class="fa fa-check"></i> <strong>`HERO_OPTIONS` Row added!</strong></p>';
		} else {
			$msg_body .= '<p><i class="fa fa-times"></i> <strong>`HERO_OPTIONS` Failed!</strong></p>';
			$msg_body .= '<p><i class="fa fa-times"></i> '.$link->error.'</p>';
		}
		
		mysqli_close($link);
	}
	
	echo '
	<div class="alert '.$msg_class.'">
		<h4>'.$msg_title.'</h4>
		'.$msg_body.'
		<p><br/><a href="dashboard.php" class="btn btn-default">RETURN TO DASHBOARD</a></p>
	</div>';
}//setupDatabaseTable

function checkCustomThumbs(){
	$zdopt = unserialize(CONFIGS);
	
	$msg_class = '';
	$msg_title = '';
	$msg_body = '';

	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		$msg_title = 'Database Connection Errors!';
		$msg_class = 'alert-danger';
		$msg_body .= '<p><i class="fa fa-times"></i> Unable to connect to the database, please check the settings below!!!</p>';
	} else {
		$msg_title = 'Checking database for Custom Thumbnail Positions!';
		mysqli_set_charset($link, 'utf8');
		
		//CHECK DATABASE FOR CUSTOM THUMBNAIL POSITIONS
		$sql_check_thumbs = "SELECT * FROM plg_previewthumb WHERE Title = '[ZD3] Video Poster' LIMIT 1";
		$result_check = mysqli_query($link, $sql_check_thumbs);
		$num_rows = mysqli_num_rows($result_check);
		if($num_rows > 0 ) {
			$msg_class = 'alert-success';
			$msg_body .= '<p><i class="fa fa-check"></i> <strong>[ZD3] Video Poster</strong> EXISTS!</p>';
			$msg_body .= '<p><i class="fa fa-check"></i> Assuming all other custom ones are also inserted!</p>';
			$msg_body .= '<p>No need to <strong>SETUP CUSTOM THUMBNAILS</strong></p>';
		} else {
			$msg_class = 'alert-danger';
			$msg_body .= '<p><i class="fa fa-times"></i> <strong>[ZD3] Video Poster</strong> IS NOT IN THE DATABASE!</p>';
			$msg_body .= '<p><i class="fa fa-times"></i> Assuming all other custom ones are also missing!</p>';
			$msg_body .= '<p>Please <strong>SETUP CUSTOM THUMBNAILS</strong> below.</p>';
		}
		
		mysqli_close($link);
	}
	
	echo '
	<div class="alert '.$msg_class.'">
		<h4>'.$msg_title.'</h4>
		'.$msg_body.'
	</div>';
}//checkCustomThumbs

function checkCustomThumbsButton(){
	$zdopt = unserialize(CONFIGS);

	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		echo $link->error;
	} else {
		mysqli_set_charset($link, 'utf8');
		
		//CHECK DATABASE FOR CUSTOM THUMBNAIL POSITIONS
		$sql_check_thumbs = "SELECT * FROM plg_previewthumb WHERE Title = '[ZD3] Video Poster' LIMIT 1";
		$result_check = mysqli_query($link, $sql_check_thumbs);
		$num_rows = mysqli_num_rows($result_check);
		if($num_rows > 0 ) {
			return false;
		} else {
			return true;
		}
		mysqli_close($link);
	}
}//checkCustomThumbsButton

function get_theme_options($where){
	$zdopt = unserialize(CONFIGS);
	
	$msg_class = '';
	$msg_title = '';
	$msg_body = '';

	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		echo $link->error;
	} else {
		mysqli_set_charset($link, 'utf8');
		
		$custom_options_table = '_zd_theme_options_'.$zdopt['evx_siteid'].'_'.$zdopt['evx_subsiteid'];
		$sql_query = "SELECT * FROM `$custom_options_table` WHERE `Name` = '$where' LIMIT 1";
		$result = mysqli_query($link, $sql_query) or die('ERROR: '.$link->error);
		$num_rows = mysqli_num_rows($result);
		if($num_rows > 0 ) {
			while ($srow=mysqli_fetch_assoc($result)){
				$my_options = $srow['Value'];
				$my_options = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) {      
					return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
				}, $my_options );
				$my_options = unserialize($my_options);
			}
			return $my_options;
		} else {
			return 0;
		}
		
		mysqli_close($link);
	}
}//get_theme_options

// ---------------------------------------------------------------

//Form Posts
if( isset($_POST['zd_login_process']) ){
	$zd_username = $_POST['zd_username'];
	$zd_password = $_POST['zd_password'];
	
	if( $zdopt['admin_username'] == $zd_username && $zdopt['admin_password'] == $zd_password ){
		$_SESSION['login_valid'] = true;
		header('Location: dashboard.php');
	} else {
		$_SESSION['login_valid'] = false;
		header('Location: index.php?msg=login_invalid');
	}
}

if( isset($_POST['zd_config']) ){
	$evx_dbhost = $_POST['evx_dbhost'];
	$evx_dbuser = $_POST['evx_dbuser'];
	$evx_dbpass = $_POST['evx_dbpass'];
	$evx_dbname = $_POST['evx_dbname'];
	$evx_siteid = $_POST['evx_siteid'];
	$evx_subsiteid = $_POST['evx_subsiteid'];
	
	$admin_username = $_POST['admin_username'];
	$admin_password = $_POST['admin_password'];
	
	$config_file = ABSPATH.'/options/config.ini.php';
	$new_config_content = '<?php
//Administrator Details
$zdopt["admin_username"]	= "'.$admin_username.'";
$zdopt["admin_password"]	= "'.$admin_password.'";

//Database Details
$zdopt["evx_dbhost"]	= "'.$evx_dbhost.'";
$zdopt["evx_dbuser"]	= "'.$evx_dbuser.'";
$zdopt["evx_dbpass"]	= "'.$evx_dbpass.'";
$zdopt["evx_dbname"]	= "'.$evx_dbname.'";

//ElevatedX Site Details
$zdopt["evx_siteid"]	= "'.$evx_siteid.'";
$zdopt["evx_subsiteid"]	= "'.$evx_subsiteid.'";
?>';
	file_put_contents($config_file, $new_config_content);
	
	header('Location: dashboard.php?action=config_updated');
}

if( isset($_POST['options_save']) ){
	$posted['tour_url'] 		= $_POST['tour_url'];
	if( isset($_POST['vod_url']) ){
	$posted['vod_url'] 			= $_POST['vod_url'];
	}
	$posted['color_primary']	= $_POST['color_primary'];
	$posted['color_secondary']	= $_POST['color_secondary'];
	$posted['display_videos']	= $_POST['display_videos'];
	$posted['videos_count']		= $_POST['videos_count'];
	$posted['display_photos']	= $_POST['display_photos'];
	$posted['photos_count']		= $_POST['photos_count'];
	$posted['display_models']	= $_POST['display_models'];
	$posted['models_count']		= $_POST['models_count'];
	$posted['display_upcoming']	= $_POST['display_upcoming'];
	$posted['display_social']	= $_POST['display_social'];
	$posted['social_twitter']	= $_POST['social_twitter'];
	$posted['social_facebook']	= $_POST['social_facebook'];
	$posted['social_instagram']	= $_POST['social_instagram'];
	$posted['social_snapchat']	= $_POST['social_snapchat'];
	$posted['social_tumblr']	= $_POST['social_tumblr'];
	$posted['social_youtube']	= $_POST['social_youtube'];
	$posted['custom_css']		= $_POST['custom_css'];
	
	$posted['main_background_color']	= $_POST['main_background_color'];
	$posted['use_main_background_image']	= $_POST['use_main_background_image'];
	$posted['background_main_repeat']	= $_POST['background_main_repeat'];
	$posted['background_main_position']	= $_POST['background_main_position'];
	$posted['background_main_size']	= $_POST['background_main_size'];
	
	//First lets do the Upload for LOGO:
	if(isset($_FILES['file_logo']['name']) && !empty($_FILES['file_logo']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['file_logo']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = $_POST['tour_url'].'custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['file_logo']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['file_logo']['tmp_name'], $uploadfile)) {
			$posted['file_logo'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['file_logo'] = $_POST['tour_url'].'custom_assets/images/logo.png';
		}
	} else {
		$posted['file_logo'] = $_POST['file_logo_current'];
	}
	
	//Main Background Image
	if(isset($_FILES['file_background_main']['name']) && !empty($_FILES['file_background_main']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['file_background_main']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = $_POST['tour_url'].'custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['file_background_main']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['file_background_main']['tmp_name'], $uploadfile)) {
			$posted['file_background_main'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['file_background_main'] = $_POST['tour_url'].'custom_assets/images/bg.jpg';
		}
	} else {
		$posted['file_background_main'] = $_POST['file_background_main_current'];
	}
	
	//Update the Database:
	$posted_serialized = serialize($posted);
	
	$zdopt = unserialize(CONFIGS);
	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		echo $link->error;
	} else {
		mysqli_set_charset($link, 'utf8');
		
		$custom_options_table = '_zd_theme_options_'.$zdopt['evx_siteid'].'_'.$zdopt['evx_subsiteid'];
		$sql_query = "UPDATE `$custom_options_table` SET `Value` = '$posted_serialized' WHERE `Name` = 'THEME_OPTIONS';";
		$result = mysqli_query($link, $sql_query) or die('ERROR: '.$link->error);
		
		mysqli_close($link);
	}

	header('Location: options.php?action=options_updated');
}

if( isset($_POST['hero_save']) ){
	$posted['hero_slideshow']	= $_POST['hero_slideshow'];
	
	$posted['videobg_url']	= $_POST['videobg_url'];
	
	$posted['display_overlay_box']	= $_POST['display_overlay_box'];
	$posted['overlay_text']	= $_POST['overlay_text'];
	$posted['display_overlay_buttons']	= $_POST['display_overlay_buttons'];
	$posted['trailer_url']	= $_POST['trailer_url'];
	
	$posted['slideshow_01_display']	= $_POST['slideshow_01_display'];
	$posted['slideshow_01_link']	= $_POST['slideshow_01_link'];
	$posted['slideshow_01_target']	= $_POST['slideshow_01_target'];
	$posted['slideshow_02_display']	= $_POST['slideshow_02_display'];
	$posted['slideshow_02_link']	= $_POST['slideshow_02_link'];
	$posted['slideshow_02_target']	= $_POST['slideshow_02_target'];
	$posted['slideshow_03_display']	= $_POST['slideshow_03_display'];
	$posted['slideshow_03_link']	= $_POST['slideshow_03_link'];
	$posted['slideshow_03_target']	= $_POST['slideshow_03_target'];
	$posted['slideshow_04_display']	= $_POST['slideshow_04_display'];
	$posted['slideshow_04_link']	= $_POST['slideshow_04_link'];
	$posted['slideshow_04_target']	= $_POST['slideshow_04_target'];
	$posted['slideshow_05_display']	= $_POST['slideshow_05_display'];
	$posted['slideshow_05_link']	= $_POST['slideshow_05_link'];
	$posted['slideshow_05_target']	= $_POST['slideshow_05_target'];
	
	//First lets do the Upload
	//STATIC IMAGE:
	if(isset($_FILES['static_image']['name']) && !empty($_FILES['static_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['static_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['static_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['static_image']['tmp_name'], $uploadfile)) {
			$posted['static_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['static_image'] = TOURURL.'/';
		}
	} else { $posted['static_image'] = $_POST['static_image_current']; }
	
	//SLIDE #01 IMAGE:
	if(isset($_FILES['slideshow_01_image']['name']) && !empty($_FILES['slideshow_01_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['slideshow_01_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['slideshow_01_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['slideshow_01_image']['tmp_name'], $uploadfile)) {
			$posted['slideshow_01_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['slideshow_01_image'] = TOURURL.'/';
		}
	} else { $posted['slideshow_01_image'] = $_POST['slideshow_01_image_current']; }
	
	//SLIDE #02 IMAGE:
	if(isset($_FILES['slideshow_02_image']['name']) && !empty($_FILES['slideshow_02_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['slideshow_02_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['slideshow_02_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['slideshow_02_image']['tmp_name'], $uploadfile)) {
			$posted['slideshow_02_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['slideshow_02_image'] = TOURURL.'/';
		}
	} else { $posted['slideshow_02_image'] = $_POST['slideshow_02_image_current']; }
	
	//SLIDE #03 IMAGE:
	if(isset($_FILES['slideshow_03_image']['name']) && !empty($_FILES['slideshow_03_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['slideshow_03_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['slideshow_03_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['slideshow_03_image']['tmp_name'], $uploadfile)) {
			$posted['slideshow_03_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['slideshow_03_image'] = TOURURL.'/';
		}
	} else { $posted['slideshow_03_image'] = $_POST['slideshow_03_image_current']; }
	
	//SLIDE #04 IMAGE:
	if(isset($_FILES['slideshow_04_image']['name']) && !empty($_FILES['slideshow_04_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['slideshow_04_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['slideshow_04_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['slideshow_04_image']['tmp_name'], $uploadfile)) {
			$posted['slideshow_04_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['slideshow_04_image'] = TOURURL.'/';
		}
	} else { $posted['slideshow_04_image'] = $_POST['slideshow_04_image_current']; }
	
	//SLIDE #05 IMAGE:
	if(isset($_FILES['slideshow_05_image']['name']) && !empty($_FILES['slideshow_05_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['slideshow_05_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['slideshow_05_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['slideshow_05_image']['tmp_name'], $uploadfile)) {
			$posted['slideshow_05_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['slideshow_05_image'] = TOURURL.'/';
		}
	} else { $posted['slideshow_05_image'] = $_POST['slideshow_05_image_current']; }
	
	//VIDEO POSTER IMAGE:
	if(isset($_FILES['video_poster_image']['name']) && !empty($_FILES['video_poster_image']['name'])){
		$randomnumber = date("su");
		$filename = $_FILES['video_poster_image']['name'];
		$uploaddir = ABSPATH.'/uploads/';
		$uploadurl = TOURURL.'/custom_assets/uploads/';
		$uploadfilename = $randomnumber . '_' . basename($_FILES['video_poster_image']['name']);
		$uploadfile = $uploaddir . $uploadfilename;
		$uploadurlfile = $uploadurl . $uploadfilename;
		if (move_uploaded_file($_FILES['video_poster_image']['tmp_name'], $uploadfile)) {
			$posted['video_poster_image'] = $uploadurlfile;
		} else {
			die("Upload failed");
			$posted['video_poster_image'] = TOURURL.'/';
		}
	} else { $posted['video_poster_image'] = $_POST['video_poster_image_current']; }
	
	//Update the Database:
	$posted_serialized = serialize($posted);
	
	$zdopt = unserialize(CONFIGS);
	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		echo $link->error;
	} else {
		mysqli_set_charset($link, 'utf8');
		
		$custom_options_table = '_zd_theme_options_'.$zdopt['evx_siteid'].'_'.$zdopt['evx_subsiteid'];
		$sql_query = "UPDATE `$custom_options_table` SET `Value` = '$posted_serialized' WHERE `Name` = 'HERO_OPTIONS';";
		$result = mysqli_query($link, $sql_query) or die('ERROR: '.$link->error);
		
		mysqli_close($link);
	}
	header('Location: hero.php?action=hero_updated');
}

if( isset($_POST['advanced_save']) ){
	//Update the Database:
	$zdopt = unserialize(CONFIGS);
	$link=mysqli_connect($zdopt['evx_dbhost'], $zdopt['evx_dbuser'], $zdopt['evx_dbpass'], $zdopt['evx_dbname']);
	if (!$link) {
		//Database Connection Failed
		echo $link->error;
	} else {
		mysqli_set_charset($link, 'utf8');
		
		$sql_previewthumbs = "INSERT INTO `plg_previewthumb` 
		(`websiteid`, `Title`, `Priority`, `CaptureType`, `Src`, `StartRange`, `EndRange`, `ThumbType`, `Quality`, `Automatic`, `VidStartRange`, `VidEndRange`, `VidStartEndType`, `Sharpen`, `Brightness`, `Contrast`, `GaussianBlur`, `SelectiveBlur`, `SmartBlur`, `GreyScale`, `Saturation`, `CheckDefault`, `Rotate`, `DVDonly`) 
		VALUES
		(0,	'[ZD3] Video Poster',		400,	0,	'highres,vids',	0,	100,	'set',	95,	0,	15,	50,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #01',	401,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #02',	402,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #03',	403,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #04',	404,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #05',	405,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Video Thumb #06',	406,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Photo Thumb #01',	407,	0,	'highres,vids',	0,	100,	'set',	95,	0,	5,	10,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] Model Thumbnail',	408,	0,	'highres,vids',	0,	0,	'model',	95,	0,	0,	0,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0),
		(0,	'[ZD3] DVD Thumbnail',		408,	0,	'highres,vids',	0,	0,	'dvd',	95,	0,	0,	0,	0,	2,	0,	0,	0,	0,	0,	0,	0,	1,	0,	0);";

		$sql_priorities = "INSERT INTO `prioritydefaults` 
		(`websiteid`, `PriorityDesc`, `Priority`, `Width`, `Height`, `RetinaMode`, `use_sets`, `use_categories`, `use_models`, `use_dvds`, `use_bonus`) 
		VALUES
		(0,	'[ZD3] Video Poster',		400,	1160,	653,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #01',	401,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #02',	402,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #03',	403,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #04',	404,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #05',	405,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Video Thumb #06',	406,	630,	355,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Photo Thumb #01',	407,	625,	830,	0,	1,	0,	0,	0,	0),
		(0,	'[ZD3] Model/DVD Thumbnail',	408,	625,	830,	0,	0,	0,	1,	1,	0);";
		
		$result_sql_previewthumbs = mysqli_query($link, $sql_previewthumbs) or die('ERROR: '.$link->error);
		$result_sql_priorities = mysqli_query($link, $sql_priorities) or die('ERROR: '.$link->error);
		
		mysqli_close($link);
	}
	header('Location: advanced.php?action=advanced_updated');
}

function versionCheck(){
	$current_version = ZD03VERSION;
	
	$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
	$parsed_url = parse_url($url);
	$domain = $parsed_url['host'];
	
	$msg_class = 'alert-info';
	$msg_title = 'Version Check';
	$msg_body  = ' <i class="fa fa-chevron-right"></i> Current Installed Version: <strong>'.$current_version.'</strong><br/>';
	
	$xml = new SimpleXMLElement('http://cmsdev.zuzanadesigns.com/zd03version.php', LIBXML_NOCDATA, true);
	$latest_version = $xml->version[0];
	
	$msg_body  .= ' <i class="fa fa-chevron-right"></i> Public released version: <strong>'.$latest_version.'</strong><br/>';
	
	if( $current_version != $latest_version ){
		$zdopt = unserialize(CONFIGS);
		echo '<script>jQuery(function($) { $("a.toggleDefaultEmail").click(function(e){ e.preventDefault(); $("textarea#default_email").slideToggle(); }); });</script>';
		$email_destination = 'miguel@zuzanadesigns.com';
		$email_subject = '[UPGRADE REQUEST] ZD03 Template - '.$domain;
		$email_body = "- FILL UP, COPY AND PASTE THE CONTENTS FROM THIS TEXTAREA - \n\n";
		$email_body .= "SEND TO: $email_destination\n";
		$email_body .= "-- START COPY ---------------------------\n";
		$email_body .= "ZDOPTIONS: $url\n";
		$email_body .= "ZDADMIN USER: $zdopt[admin_username]\n";
		$email_body .= "ZDADMIN PASS: $zdopt[admin_password]\n";
		$email_body .= "FTP HOST: please fill in\n";
		$email_body .= "FTP PORT: please fill in\n";
		$email_body .= "FTP USER: please fill in\n";
		$email_body .= "FTP PASS: please fill in\n";
		$email_body .= "TOUR URL: please fill in\n";
		$email_body .= "MEMBERS-AREA URL: please fill in\n";
		$email_body .= "MEMBERS-AREA USER: please fill in\n";
		$email_body .= "MEMBERS-AREA PASS: please fill in\n";
		$email_body .= "-- END COPY ---------------------------\n";
		$msg_body .= '<p><br/><a href="#" class="btn btn-default btn-small toggleDefaultEmail">Request an upgrade to latest version ('.$latest_version.')</a></p>';
		$msg_body .= '<p><textarea class="form-control" style="display:none; height:360px;" id="default_email">'.$email_body.'</textarea></p>';
	}
	
	echo '
	<div class="alert '.$msg_class.'">
		<h4>'.$msg_title.'</h4>
		'.$msg_body.'
	</div>';
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit