| 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/members/setup/ |
Upload File : |
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//This custom tool is for #TEMPLATE 01#
// Main purpose: Create the necessary Template Fields
// Contact: miguel@zuzanadesigns.com if you need assistance
//Configuration - Confirm all values:
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'cmsdz');
define('MYSQL_PASS', '42lnuNTQaf');
define('MYSQL_DATABASE', 'cmsdz');
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Zuzana Designs Tools</title>
<meta name="author" content="Zuzana Designs, sales@zuzanadesigns.com">
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="zuzanadesigns_tools.css" />
<!-- jQuery Stuff -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="zuzanadesigns_tools.js"></script><!--//custom jquery-->
</head>
<body>
<!--[if lt IE 7]><p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p><![endif]-->
<div class="wrapper">
<h1>Zuzana Designs - Eraser Tool (Template01)</h1>
<div class="intro">
<p>This tool is custom built to eraser previously inserted Templatefields into the database, for template: <strong>Template01</strong>.</p>
<p class="cRed"><strong>NOTE: IF YOU USE THIS TOOL, YOU WILL ERASE ALL THE CUSTOM FIELDS PREVIOUSLY INSERTED, INCLUDING TRANSLATIONS!</strong></p>
<p>If you arrived here by mistake, go back to the <a href="zuzanadesigns_tools.php"><strong>INSERT TOOL</strong></a>.</p>
<p>In order to use it, you have to SETUP this file, so, that means you have to edit it, and change the following variables:</p>
<span class="col col-left">
<h5>Setup Variables:</h5>
<ul class="square">
<li><span class="cRed">MYSQL_HOST</span></li>
<li><span class="cRed">MYSQL_USER</span></li>
<li><span class="cRed">MYSQL_PASS</span></li>
<li><span class="cRed">MYSQL_DATABASE</span></li>
</ul>
</span>
<?php if(MYSQL_HOST == '' || MYSQL_USER == '' || MYSQL_PASS == '' || MYSQL_DATABASE == '') { ?>
<span class="col col-right bgRed">
<h2 class="error">You haven't SETUP the variables in this file. You will not be able to continue until you do.</h2>
</span>
<?php } else { ?>
<span class="col col-right bgGray">
<h5>Current Setup:</h5>
<ul class="square">
<li><span class="cRed">MYSQL_HOST</span>: <strong><?php echo MYSQL_HOST; ?></strong></li>
<li><span class="cRed">MYSQL_USER</span>: <strong><?php echo MYSQL_USER; ?></strong></li>
<li><span class="cRed">MYSQL_PASS</span>: <strong><?php echo MYSQL_PASS; ?></strong></li>
<li><span class="cRed">MYSQL_DATABASE</span>: <strong><?php echo MYSQL_DATABASE; ?></strong></li>
</ul>
</span>
<?php } ?>
</div>
<?php
if(MYSQL_HOST == '' || MYSQL_USER == '' || MYSQL_PASS == '' || MYSQL_DATABASE == '') {
die();
} else {
$link=mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
mysql_set_charset('utf8',$link);
if (!$link) { die('Could not connect: ' . mysql_error()); }
mysql_select_db(MYSQL_DATABASE,$link);
echo '<div class="steps">';
if( isset($_POST['confirm_submission']) ){
setupSteps(4);
} else {
setupSteps(1);
if( isset($_POST['step']) && ( ($_POST['step'] == 1 && $_POST['websiteid'] != '') || $_POST['step'] == 2 || $_POST['step'] == 3) ){
setupSteps(2);
}
if( isset($_POST['step']) && ( ($_POST['step'] == 2 && $_POST['websiteid'] != '' && $_POST['sitearea'] != '') || $_POST['step'] == 3) ){
setupSteps(3);
}
if( isset($_POST['step']) && ( ($_POST['step'] == 3 && $_POST['confirm_submission']) || $_POST['step'] == 4) ){
setupSteps(4);
}
}
echo '</div>';
}
?>
</div><!--//wrapper-->
</body>
</html>
<?php
function setupSteps($step){
?>
<?php if($step == 1){ ?>
<div class="step step<?php echo $step; ?>">
<h3>Step #<?php echo $step; ?>: Input the SiteID</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="step" value="1" />
<p>
<label>Website ID:</label>
<input type="text" name="websiteid" value="<?php if( isset($_POST['websiteid']) && $_POST['websiteid'] != '' ) { echo $_POST['websiteid']; } else { echo '0'; } ?>" />
</p>
<p>
<input type="submit" value="Set Website ID" name="setup_websiteid" />
</p>
</form>
</div><!--//step1-->
<?php } ?>
<?php if($step == 2){ ?>
<div class="step step<?php echo $step; ?>">
<h3>Step #<?php echo $step; ?>: Select the Site Area</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="websiteid" value="<?php if( isset($_POST['websiteid']) && $_POST['websiteid'] != '' ) { echo $_POST['websiteid']; } ?>" />
<p>
<label>Site Area <span class="cRed">( [[TemplateFolder]] > TemplateLabel )</span>:</label>
<select name="sitearea">
<option value="">- Select Correct Site Area -</option>
<?php
$areas = getSiteAreas($_POST['websiteid']);
if($areas == 'ERROR'){
echo '<option>Wrong Site ID added above!!!</option>';
} else {
foreach($areas as $area){
if( isset($_POST['sitearea']) && $_POST['sitearea'] != '' ) {
if($_POST['sitearea'] == $area['area_Id']) { echo '<option selected="selected" value="'.$area['area_Id'].'">[['.$area['area_TemplateFolder'].']] > '.$area['area_Label'].'</option>'; }
else { echo '<option value="'.$area['area_Id'].'">[['.$area['area_TemplateFolder'].']] > '.$area['area_Label'].'</option>'; }
} else {
echo '<option value="'.$area['area_Id'].'">[['.$area['area_TemplateFolder'].']] > '.$area['area_Label'].'</option>';
}
}
}
?>
</select>
<small>The list only shows the site areas that you already inserted the custom template fields.</small>
</p>
<?php if($areas != 'ERROR'){ ?>
<p>
<input type="submit" value="Select Site Area" name="setup_sitearea" />
</p>
<?php } ?>
</form>
</div><!--//step2-->
<?php } ?>
<?php if($step == 3){ ?>
<div class="step step<?php echo $step; ?>">
<h3>Step #<?php echo $step; ?>: Confirm everything before erasing!</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="step" value="3" />
<input type="hidden" name="websiteid" value="<?php if( isset($_POST['websiteid']) && $_POST['websiteid'] != '' ) { echo $_POST['websiteid']; } ?>" />
<input type="hidden" name="sitearea" value="<?php if( isset($_POST['sitearea']) && $_POST['sitearea'] != '' ) { echo $_POST['sitearea']; } ?>" />
<p><strong>Site ID:</strong> <?php echo $_POST['websiteid']; ?></p>
<p><strong>Site Area:</strong>
<br/>
<?php getSiteAreaInfo($_POST['websiteid'], $_POST['sitearea']); ?>
</p>
<p>
<input type="submit" value="I Confirm everything is correct!" name="confirm_submission" />
<br/>
<small class="cRed">By clicking the above button, the script will erase all the custom Template Fields. This is irreversible, so, make sure you have your database backed-up before doing this.</small>
</p>
</form>
</div><!--//step3-->
<?php } ?>
<?php if($step == 4){ ?>
<div class="step step<?php echo $step; ?>">
<h3>Step #<?php echo $step; ?>: Success!!!</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="step" value="4" />
<input type="hidden" name="websiteid" value="<?php if( isset($_POST['websiteid']) && $_POST['websiteid'] != '' ) { echo $_POST['websiteid']; } ?>" />
<input type="hidden" name="sitearea" value="<?php if( isset($_POST['sitearea']) && $_POST['sitearea'] != '' ) { echo $_POST['sitearea']; } ?>" />
<h3 class="cGreen">Custom Fields Erased!</h3>
<pre><?php deleteCustomTemplateFields($_POST['websiteid'], $_POST['sitearea']); ?></pre>
<h3 class="cGreen"><a href="zuzanadesigns_eraser.php">Erase More Custom Fields</a> | <a href="zuzanadesigns_tools.php">Insert Custom Fields</a></h3>
</form>
</div><!--//step4-->
<?php } ?>
<?php
}//function setupSteps
function getSiteAreas($websiteid){
$link=mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
mysql_set_charset('utf8',$link);
if (!$link) { die('Could not connect: ' . mysql_error()); }
mysql_select_db(MYSQL_DATABASE,$link);
$sql='SELECT * FROM `areas` WHERE `websiteid` = "'.$websiteid.'" AND `TemplateLanguage`="php" ORDER BY `Id` ASC';
$result = mysql_query($sql, $link) or die('ERROR: '.mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows > 0) {
while ($row=mysql_fetch_assoc($result)){
$item['area_Id'] = $row['Id'];
$item['area_Label'] = $row['Label'];
$item['area_TemplateFolder'] = $row['TemplateFolder'];
//Lets now check if this section already has any of the custom templatefields, for example: "zdtxttourtitle"
$sql_check='SELECT * FROM `plg_templateconf` WHERE `websiteid` = "'.$websiteid.'" AND `AreaId` = "'.$item["area_Id"].'" AND `Name`="zdtxttourtitle"';
$result_check = mysql_query($sql_check, $link) or die('ERROR: '.mysql_error());
$num_rows_check = mysql_num_rows($result_check);
if($num_rows_check > 0) {
$item['already_exists'] = 1;
$areas[] = $item;
} else {
$item['already_exists'] = 0;
//Lets avoid user errors and not show the Areas that do no have the field "zdtxttourtitle"
}
}
return $areas;
} else {
return 'ERROR';
}
}//function getSiteAreas
function getSiteAreaInfo($websiteid,$sitearea){
$link=mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
mysql_set_charset('utf8',$link);
if (!$link) { die('Could not connect: ' . mysql_error()); }
mysql_select_db(MYSQL_DATABASE,$link);
$sql='SELECT * FROM `areas` WHERE `websiteid` = "'.$websiteid.'" AND `TemplateLanguage`="php" AND `Id` = "'.$sitearea.'" ORDER BY `Id` ASC LIMIT 1';
$result = mysql_query($sql, $link) or die('ERROR: '.mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows > 0) {
while ($row=mysql_fetch_assoc($result)){
$item['area_Id'] = $row['Id'];
$item['area_Label'] = $row['Label'];
$item['area_TemplateFolder'] = $row['TemplateFolder'];
}
echo ' - <strong>ID</strong>: '.$item['area_Id'].'<br/>';
echo ' - <strong>Label</strong>: '.$item['area_Label'].'<br/>';
echo ' - <strong>TemplateFolder</strong>: '.$item['area_TemplateFolder'].'<br/>';
} else {
echo 'ERROR';
}
}//function getSiteAreaInfo
function deleteCustomTemplateFields($websiteid,$sitearea){
$link=mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
mysql_set_charset('utf8',$link);
if (!$link) { die('Could not connect: ' . mysql_error()); }
mysql_select_db(MYSQL_DATABASE,$link);
$templateCategoryName = 'Custom Fields ZuzanaDesigns';
//delete records from the database:
$sql_delete = "DELETE FROM plg_templateconf WHERE websiteid='$websiteid' AND AreaId='$sitearea' AND TemplateCategory='$templateCategoryName'";
mysql_query($sql_delete) or die( 'ERROR: '.mysql_error().'<br/>SQL==== '.$sql_delete );
}//function deleteCustomTemplateFields
?>