|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/zapnixinc.com/admin/ | |
|
Path: /home2/outerorb/zapnixinc.com/admin/manage_location_content.php
Size: 21 KB
Permissions: 0644
<?php
include_once("../include/main.inc.php");
// error_reporting(0);
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
// check_session('MyCpanel','index.php');
################ Paging Starts From Here ##################
@extract($_REQUEST);
$start = isset($start) && intval($start) >= 0 ? intval($start) : 0;
$pagesize = isset($pagesize) && intval($pagesize) > 0 ? intval($pagesize) : 20;
$heading="Manage Subdomain Content";
$record_type="Content";
$script_name="manage_location_content.php";
$table_name="location_content_tbl";
####################################################
$id = isset($id) ? $id : '';
// echo $id."---";
// print_r($_POST);die;
if($id=="add_record") {
$location_name = array();
$about_short_desc=$_POST['about_short_desc'];
$about_desc=$_POST['about_desc'];
$short_description = htmlentitiesDecode($short_description);
$about_short_desc = htmlentitiesDecode($about_short_desc);
$location = implode(',',$location_ids);
$location_sql = mysqli_query($dbconn,"SELECT * FROM $table_name where location_ids='$location' AND category_id='$category_id'");
if(mysqli_num_rows($location_sql)==0){
$sql=db_query("insert into $table_name set category_id='$category_id', location_id='0', location_ids='$location', meta_keyword='$meta_keyword', meta_description='$meta_description', meta_title='$meta_title', description='$description',short_description='$short_description',heading2='$heading2',about_short_desc='$about_short_desc',about_desc='$about_desc'");
}else{
foreach($location_ids as $key => $locations){
$location_sql = mysqli_query($dbconn,"SELECT * FROM $table_name where location_id='$locations' AND category_id='$category_id'");
if(mysqli_num_rows($location_sql)==0){
// $location = implode(',',$location_ids);
$sql=db_query("insert into $table_name set category_id='$category_id', location_id='0', location_ids='$locations', meta_keyword='$meta_keyword', meta_description='$meta_description', meta_title='$meta_title', description='$description',heading2='$heading2',short_description='$short_description',about_short_desc='$about_short_desc',about_desc='$about_desc'");
// echo "insert into $table_name set category_id='$category_id', location_id='0', location_ids='$location', meta_keyword='$meta_keyword', meta_description='$meta_description', meta_title='$meta_title', description='$description',short_description='$short_description'"; die;
} else{
$check=true;
$location_name[] = get_location_name($location);
}
}
}
if($check==true){
$location_string = implode(',', $location_name);
$_SESSION['session_message']=$record_type.' for '.$location_string.' is Already Submitted.';
header("Location: ".SITE_ADMIN_URL."/".$script_name."?category_id=".$category_id);
exit;
}
$_SESSION['session_message']='New '.$record_type.' has been added successfully';
header("Location: ".SITE_ADMIN_URL."/".$script_name."?category_id=".$category_id);
exit;
}
if($id=="update_record") {
$about_short_desc=$_POST['about_short_desc'];
$about_desc=$_POST['about_desc'];
$short_description = htmlentitiesDecode($short_description);
$about_short_desc = htmlentitiesDecode($about_short_desc);
$location = implode(',',$location_ids);
updateTable($table_name,"location_id='0',location_ids='$location', category_id='$category_id', meta_keyword='$meta_keyword', meta_description='$meta_description', meta_title='$meta_title', description='$description', short_description='$short_description',heading2='$heading2', about_short_desc='$about_short_desc', about_desc='$about_desc' where id='$recordID'");
$_SESSION['session_message']=$record_type.' has been updated successfully';
header("Location: ".SITE_ADMIN_URL."/".$script_name."?category_id=".$category_id);
exit;
}
if($id=="delete_record") {
db_query("delete from $table_name where id='$recordID'");
$_SESSION['session_message']=$record_type.' has been deleted successfully';
header("Location: ".SITE_ADMIN_URL."/".$script_name."?category_id=".$category_id);
exit;
}
admin_header();
$qry= db_query("select * from $table_name where category_id='$category_id'");
?>
<style>
select[multiple],
select[size] {
height: 200px;
}
</style>
<div class="content-wrapper">
<div class="page-header">
<h3 class="page-title">
<?=$heading;?>
</h3>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<?admin_url?>welcome.php">Admin</a></li>
<li class="breadcrumb-item active" aria-current="page"><?=$heading;?></li>
</ol>
</nav>
</div>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table id="order-listing" class="table table-bordered table-hover">
<thead>
<tr>
<th>S.No.</th>
<th>Category Name</th>
<th>Location</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$sl=$start+1;
while($arr=mysqli_fetch_array($qry)) {
$location_name = ($arr['location_id'] == 0)?'All':get_location_name($arr['location_id']);
$category_name = ($arr['category_id'] == 0)?'Home':get_category_name($arr['category_id']); ?>
<tr>
<td><?=$sl?></td>
<!-- <td><p class="ordern"><=$category_name;?></p></td>
<td><p class="dongle-dcs"> <=$location_name;?></p></td> -->
<td align="left"><?= $category_name?></td>
<td align="left"><?=$location_name?></td>
<td><p class="download-dcs">
<a href="<?=$script_name;?>?category_id=<?= $category_id ?>&id=edit_record&recordID=<?=$arr['id'];?>#bot">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-3"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>
</a>
<a href="<?=$script_name;?>?category_id=<?= $category_id?>&id=delete_record&recordID=<?=$arr['id'];?>" onClick="return confirm('Are you sure to delete this record...');">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16"> <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/> <path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/> </svg></a></p>
</td>
</tr>
<?php $sl++; }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="content-wrapper">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<form name="bannerFrm" method=post action="" enctype="multipart/form-data" onSubmit="return validate('bannerFrm') && chk_valid_date();">
<?php
if((!isset($_GET['recordID']) || $_GET['recordID'] == "") || $id != "edit_record") {
// if($_GET['recordID']=="" || $id!="edit_record") {
?>
<div class="text-center">
<h3>Add New <?=$record_type;?></h3>
</div>
<?php
}
else {
?>
<div align="left" height="20">
<h3>Edit <?=$record_type;?></h3>
</div>
<div align="right" height="20"><a class="btn btn-primary text-light" href="<?=$script_name.'?category_id='.$category_id;?>"><b>Add New <?=$record_type;?></b></a></div>
<br />
<?php
$gid = $_GET['recordID'];
}
$gid = isset($gid) ? $gid : null;
$res=getResult($table_name," where id='$gid'");
// print_r($res); die;
$location_sql = mysqli_query($dbconn,"SELECT * FROM location_tbl WHERE parentID ='0' order by locationName asc");
$category_name = ($category_id == 0)?'Home':get_category_name($category_id);
?>
<div class="form-group">
<label>Category<span>*</span></label>
<input type="text" name="category_name" value="<?= $category_name ?>" readonly class="form-control" />
</div>
<div class="form-group">
<!-- <label>Location<span>*</span></label>
<label><input type="checkbox" name="check_all" id="checkAll"> All locations</label>
<div class="col-sm-6" style="float:right;">
<label><input type="checkbox" name="check_half" id="checkHalf"> 50% Locations</label>
</div> -->
<div class="row">
<div class="col-md-4">
<label class="checkbox-label">
<input type="checkbox" name="check_all" id="checkAll">
<span class="custom-checkbox"></span> All locations
</label>
</div>
<div class="col-md-8">
<label class="checkbox-label">
<input type="checkbox" name="check_half" id="checkHalf">
<span class="custom-checkbox"></span> 50% Locations
</label>
</div>
</div>
<div class="market-locations" style="height:400px;overflow-y:scroll;">
<?php while($location = mysqli_fetch_array($location_sql)){
$selct_cat_query = "select * from $table_name WHERE id ='$gid'";
$res_cat = $dbconn->query($selct_cat_query);
$cat_loca = $res_cat->fetch_assoc();
if (isset($cat_loca) && is_array($cat_loca) && isset($cat_loca['location_ids'])) {
$loca_cat = explode(",", $cat_loca['location_ids']);
} else {
$loca_cat = [];
}
// $loca_cat = explode(",", $cat_loca['location_ids']);
// print_r($loca_cat);die;
$checked = '';
if(in_array($location['locationID'], $loca_cat)){
$checked = 'checked';
}else{
$checked = '';
}
?>
<div class="row"><div class="col-sm-12 location-cls checked-loca">
<?php if($location['status'] == 'Y') { ?><input type="checkbox" name="location_ids[]" value="<?= $location['locationID']; ?>" <?= $checked; ?>> <strong><?= $location['locationName']; ?></strong>
<?php } else { ?><label><?= $location['locationName']; ?></label>
<?php } ?>
</div>
<?php $parentID = $location['locationID'];
$sub_location_sql = mysqli_query($dbconn,"SELECT * FROM location_tbl WHERE parentID='$parentID' order by locationName asc");
$total_sub_loca = mysqli_num_rows($sub_location_sql);
// print_r($total_sub_loca); die;
if(mysqli_num_rows($sub_location_sql)>0){
while($sub_location = mysqli_fetch_array($sub_location_sql)){
$selct_cat_query = "select * from $table_name WHERE id='$gid'";
$res_cat = $dbconn->query($selct_cat_query);
$cat_loca = $res_cat->fetch_assoc();
if (isset($cat_loca['location_ids']) && !empty($cat_loca['location_ids'])) {
$loca_cat = explode(",", $cat_loca['location_ids']);
} else {
// Handle the case where 'location_ids' is not set or empty
$loca_cat = []; // Initialize as an empty array or handle it as per your needs
}
// $loca_cat = explode(",", $cat_loca['location_ids']);
$checked = '';
if(in_array($sub_location['locationID'], $loca_cat)){
$checked = 'checked';
}else{
$checked = '';
}
?>
<div class="col-sm-12 location-cls checked-loca">
<input type="checkbox" name="location_ids[]" value="<?= $sub_location['locationID']; ?>" <?= $checked; ?>> <label><?= $sub_location['locationName']; ?></label>
</div>
<?php $subsub_location_sql = mysqli_query($dbconn,"SELECT * FROM location_tbl WHERE parentID='".$sub_location['locationID']."' order by locationName asc");
$total_subsub_loca = mysqli_num_rows($subsub_location_sql);
$half_subsub_loca = 0;
if($half_subsub_loca % 2 == 0){
$half_subsub_loca = $total_subsub_loca / 2;
}else{
$half_subsub_loca = ($total_subsub_loca + 1) / 2;
}
if(mysqli_num_rows($subsub_location_sql)>0){
$counting = 0;
while($subsub_location = mysqli_fetch_array($subsub_location_sql)){
$selct_cat_query = "select * from $table_name WHERE id='$gid'";
$res_cat = $dbconn->query($selct_cat_query);
$cat_loca = $res_cat->fetch_assoc();
if (isset($cat_loca['location_ids']) && !empty($cat_loca['location_ids'])) {
$loca_cat = explode(",", $cat_loca['location_ids']);
} else {
// Handle the case where 'location_ids' is not set or empty
$loca_cat = []; // Initialize an empty array or handle it accordingly
}
// $loca_cat = explode(",", $cat_loca['location_ids']);
$checked = '';
if(in_array($subsub_location['locationID'], $loca_cat)){
$checked = 'checked';
}else{
$checked = '';
}
$counting++;
?>
<div class="col-sm-3 location-cls <?php if($counting <= $half_subsub_loca) { echo 'checked-loca'; } ?>">
<input type="checkbox" name="location_ids[]" value="<?= $subsub_location['locationID']; ?>" <?= $checked; ?>> <?= $subsub_location['locationName']; ?>
</div>
<?php } } } } ?></div><?php }
$location_sql = mysqli_query($dbconn,"SELECT * FROM location_tbl WHERE status='Y' and parentID ='0' order by locationName asc");
?>
</div>
</div>
<div class="form-group">
<label>Meta Title <span>*</span></label>
<input type="text" name="meta_title" value="<?= isset($res['meta_title']) ? $res['meta_title'] : ''; ?>" class="form-control" />
</div>
<div class="form-group">
<label>Meta Keywords<span>*</span></label>
<input type="text" name="meta_keyword" value="<?= isset($res['meta_keyword']) ? $res['meta_keyword'] : ''; ?>" class="form-control" />
</div>
<div class="form-group">
<label>Meta Description<span>*</span></label>
<textarea rows="5" cols="60" name="meta_description" class="form-control"><?= isset($res['meta_description']) ? $res['meta_description'] : ''; ?></textarea>
</div>
<div class="form-group">
<label>Short Description Top<span>*</span></label>
<textarea rows="5" cols="60" name="short_description" class="form-control"><?= isset($res['short_description']) ? $res['short_description'] : ''; ?></textarea>
</div>
<div class="form-group">
<label>Heading 2<span>*</span></label>
<input type="text" name="heading2" value="<?= isset($res['heading2']) ? $res['heading2'] : ''; ?>" class="form-control" />
</div>
<div class="form-group">
<label>Description Top<span>*</span></label>
<textarea rows="5" cols="60" id="description" name="description" class="form-control editor"><?= isset($res['description']) ? $res['description'] : ''; ?></textarea>
</div>
<div class="form-group">
<label>Short Description Bottom<span>*</span></label>
<textarea rows="5" cols="60" id="description3" name="about_short_desc" class="form-control editor"><?= isset($res['about_short_desc']) ? $res['about_short_desc'] : ''; ?></textarea>
</div>
<div class="form-group">
<label>Description Bottom<span>*</span></label>
<textarea rows="5" cols="60" id="description2" name="about_desc" class="form-control editor"><?= isset($res['about_desc']) ? $res['about_desc'] : ''; ?></textarea>
</div>
<div class="form-group">
<?php
$recordID = isset($recordID) ? $recordID : ''; // Default to an empty string if not set
if ($recordID != "") {
// if($recordID !="") {
?>
<input type="submit" name="submit" value="Update <?=$record_type;?>" class="button btn btn-success">
<input type="hidden" name="recordID" value="<?=$res['id'];?>">
<input type="hidden" name="id" value="update_record">
<?php
}
else{
?>
<input type="submit" name="submit" value="Add New <?=$record_type;?>" class="button btn btn-success">
<input type="hidden" name="id" value="add_record">
<?php
}
?>
<input type="hidden" name="start" value="<?=$start;?>">
<input type="hidden" name="pagesize" value="<?=$pagesize;?>">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="jquery.min.js"></script>
<script type="text/javascript">
$("#quickCity").change(function() {
var cityid = $('#quickCity').val();
$.ajax({
url: "ajax99.php", //The url where the server req would we made.
async: false,
type: "POST", //The type which you want to use: GET/POST
data: "cityid=" + cityid, //The variables which are going.
dataType: "html", //Return data type (what we expect).
//This is the function which will be called if ajax call is successful.
success: function(data) {
//data is the html of the page where the request is made.
$('#locatity').html(data);
}
})
});
// $(document).ready(function(){
// $('#checkAll').change(function() {
// if (this.checked) {
// $('.location-cls > input:checkbox').attr('checked', 'checked');
// }else{
// $('.location-cls > input:checkbox').attr('checked', '');
// }
// });
// $('#checkHalf').change(function(){
// if(this.checked){
// $('.checked-loca > input:checkbox').attr('checked', 'checked');
// }else{
// $('.checked-loca > input:checkbox').attr('checked', '');
// }
// })
// })
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#checkAll').change(function() {
$('.location-cls > input:checkbox').prop('checked', this.checked);
});
$('#checkHalf').change(function() {
const totalLocations = $('.location-cls > input:checkbox').length;
const halfLocations = Math.ceil(totalLocations / 2);
if (this.checked) {
$('.location-cls > input:checkbox').prop('checked', false); // Uncheck all first
$('.location-cls > input:checkbox').slice(0, halfLocations).prop('checked', true); // Check half
} else {
$('.location-cls > input:checkbox').prop('checked', false); // Uncheck all if unchecked
}
});
});
</script>
<?php define('SITE_URL_PATH', 'https://www.trh.iay.mybluehostin.me/sidsportx/'); ?>
<iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js"
src="<?=SITE_URL_PATH;?>/js/calendar/themes/Normal/ipopeng.htm"
scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
<?php
admin_footer();
exit;
?>