File "home_setting.php"
Full Path: /home/krishnamexports/public_html/panel/pages/home_setting.php
File size: 30.74 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8
<?php
include_once("fckeditor/fckeditor.php");
if(isset($_POST['submit']))
{
$website = mysqli_real_escape_string($cn,$_POST['website']);
$tagline = mysqli_real_escape_string($cn,$_POST['tagline']);
$logo = $_FILES['logo']['name'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$address = $_POST['address'];
$embed_map = $_POST['embed_map'];
$meta_keyword = mysqli_real_escape_string($cn,$_POST['meta_keyword']);
$meta_description = mysqli_real_escape_string($cn,$_POST['meta_description']);
$fav_icon = $_FILES['fav_icon']['name'];
$category_id1 = $_POST['category_id1'];
$gallery1 = $_FILES['gallery1']['name'];
$title1 = $_POST['title1'];
$subtitle1 = $_POST['subtitle1'];
$category_id2 = $_POST['category_id2'];
$gallery2 = $_FILES['gallery2']['name'];
$title2 = $_POST['title2'];
$subtitle2 = $_POST['subtitle2'];
$category_id3 = $_POST['category_id3'];
$gallery3 = $_FILES['gallery3']['name'];
$title3 = $_POST['title3'];
$subtitle3 = $_POST['subtitle3'];
$category_id4 = $_POST['category_id4'];
$gallery4 = $_FILES['gallery4']['name'];
$title4 = $_POST['title4'];
$subtitle4 = $_POST['subtitle4'];
$category_id5 = $_POST['category_id5'];
$gallery5 = $_FILES['gallery5']['name'];
$title5 = $_POST['title5'];
$subtitle5 = $_POST['subtitle5'];
$category_id6 = $_POST['category_id6'];
$gallery6 = $_FILES['gallery6']['name'];
$title6 = $_POST['title6'];
$subtitle6 = $_POST['subtitle6'];
$category_id7 = implode(',',$_POST['category_id7']);
$title7 = $_POST['title7'];
$subtitle7 = $_POST['subtitle7'];
$about_title = $_POST['about_title'];
$about_description = $_POST['about_description'];
$discount_title = mysqli_real_escape_string($cn,$_POST['discount_title']);
$discount_description = mysqli_real_escape_string($cn,$_POST['discount_description']);
$product_count = $_POST['product_count'];
$sql = mysqli_query($cn,"select * from `tbl_home`");
$sqlData = mysqli_fetch_array($sql);
if(!empty($logo))
{
move_uploaded_file($_FILES['logo']['tmp_name'],'../logo/'.$logo);
}
else
{
$logo = $_POST['old_logo'];
}
if(!empty($fav_icon))
{
move_uploaded_file($_FILES['fav_icon']['tmp_name'],'../logo/'.$fav_icon);
}
else
{
$fav_icon = $_POST['old_fav_icon'];
}
if(!empty($gallery1))
{
move_uploaded_file($_FILES['gallery1']['tmp_name'],'../home_setting/'.$gallery1);
}
else
{
$gallery1 = $sqlData['gallery1'];
}
if(!empty($gallery2))
{
move_uploaded_file($_FILES['gallery2']['tmp_name'],'../home_setting/'.$gallery2);
}
else
{
$gallery2 = $sqlData['gallery2'];
}
if(!empty($gallery3))
{
move_uploaded_file($_FILES['gallery3']['tmp_name'],'../home_setting/'.$gallery3);
}
else
{
$gallery3 = $sqlData['gallery3'];
}
if(!empty($gallery4))
{
move_uploaded_file($_FILES['gallery4']['tmp_name'],'../home_setting/'.$gallery4);
}
else
{
$gallery4 = $sqlData['gallery4'];
}
if(!empty($gallery5))
{
move_uploaded_file($_FILES['gallery5']['tmp_name'],'../home_setting/'.$gallery5);
}
else
{
$gallery5 = $sqlData['gallery5'];
}
if(!empty($gallery6))
{
move_uploaded_file($_FILES['gallery6']['tmp_name'],'../home_setting/'.$gallery6);
}
else
{
$gallery6 = $sqlData['gallery6'];
}
$sqlSubject = mysqli_query ($cn, "update `tbl_home` set `tagline`='".$tagline."', `website`='".$website."', `logo`='".$logo."', `contact`='".$contact."', `email`='".$email."', `address`='".$address."', `embed_map`='".$embed_map."', `meta_keyword`='".$meta_keyword."', `meta_description`='".$meta_description."', `fav_icon`='".$fav_icon."', `category_id1`='".$category_id1."', `gallery1`='".$gallery1."', `title1`='".$title1."', `subtitle1`='".$subtitle1."', `category_id2`='".$category_id2."', `gallery2`='".$gallery2."', `title2`='".$title2."', `subtitle2`='".$subtitle2."', `category_id3`='".$category_id3."', `gallery3`='".$gallery3."', `title3`='".$title3."', `subtitle3`='".$subtitle3."', `category_id4`='".$category_id4."', `gallery4`='".$gallery4."', `title4`='".$title4."', `subtitle4`='".$subtitle4."', `category_id5`='".$category_id5."', `gallery5`='".$gallery5."', `title5`='".$title5."', `subtitle5`='".$subtitle5."', `category_id6`='".$category_id6."', `gallery6`='".$gallery6."', `title6`='".$title6."', `subtitle6`='".$subtitle6."', `category_id7`='".$category_id7."', `title7`='".$title7."', `subtitle7`='".$subtitle7."', `about_title`='".$about_title."', `about_description`='".$about_description."', `discount_title`='".$discount_title."', `discount_description`='".$discount_description."', `product_count`='".$product_count."' where `id`='1'");
if ($sqlSubject)
{
echo '<div class="alert alert-success"><strong>Success!</strong> Home Setting Updated Successfully.</div>';
}
else
{
echo '<div class="alert alert-danger"><strong>Danger!</strong> Some Error Occur.Please Try Again Later.</div>';
}
}
$sql = mysqli_query($cn, "select * from tbl_home where id='1'");
$sqlData = mysqli_fetch_array($sql);
$arrayOurProduct = explode(',',$sqlData['category_id7']);
?>
<style>
.heading-title{
background: linear-gradient(120deg, #5983e8,#00e4d0);
text-align: center;
color:
white;
padding:10px;
font-size: 15px;
font-weight: 600;
}
</style>
<div class="card">
<h3 class="heading-title">WEBSITE DETAIL</h3>
<div class="card-body">
<form class="forms-sample" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword4">Logo Tagline</label>
<input type="text" class="form-control" name="tagline" value="<?php echo $sqlData['tagline'];?>" id="exampleInputPassword4" placeholder="Logo Tagline">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Website Title</label>
<input type="text" class="form-control" name="website" value="<?php echo $sqlData['website'];?>" id="exampleInputPassword4" placeholder="Website Title">
<input type="hidden" class="form-control" name="old_logo" value="<?php echo $sqlData['logo'];?>">
<input type="hidden" class="form-control" name="old_fav_icon" value="<?php echo $sqlData['fav_icon'];?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Website Logo</label>
<input type="file" class="form-control" name="logo" id="fileToUpload" />
<p style="color:red; ">Size must 235x53</p>
<img src="../logo/<?php echo $sqlData['logo'];?>" height="50" width="150" style="background:#000;">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Contact No.</label>
<input type="text" class="form-control" name="contact" value="<?php echo $sqlData['contact'];?>" id="exampleInputPassword4" placeholder="Contact No.">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Email</label>
<input type="text" class="form-control" name="email" value="<?php echo $sqlData['email'];?>" id="exampleInputPassword4" placeholder="Email">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">Address</label>
<textarea rows="4" cols="50" class="form-control" name="address" id="exampleInputCity1" placeholder="Address"><?php echo $sqlData['address'];?></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">Map Location ( Embed A Map )</label>
<textarea rows="4" cols="50" class="form-control" name="embed_map" placeholder="Embed A Map"><?php echo $sqlData['embed_map'];?></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Fav Icon</label>
<input type="file" class="form-control" name="fav_icon" id="fileToUpload" />
<img src="../logo/<?php echo $sqlData['fav_icon'];?>" height="50" width="50">
<p style="color:red; ">Size must 32x32</p>
</div>
</div>
<div class="col-md-9">
<div class="form-group">
<label for="exampleInputPassword4">Meta Keyword</label>
<input type="text" class="form-control" name="meta_keyword" value="<?php echo $sqlData['meta_keyword'];?>" id="exampleInputPassword4" placeholder="Meta Keyword">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">Meta Description</label>
<textarea rows="4" cols="50" class="form-control" name="meta_description" id="exampleInputCity1" placeholder="Meta Description"><?php echo $sqlData['meta_description'];?></textarea>
</div>
</div>
</div>
<h3 class="heading-title">SHOP MENU BANNER</h3><br>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Menu Banner 1</label>
<input type="file" class="form-control" name="gallery1">
<p style="color:red; ">Size must 545 X 250</p>
<img src="../home_setting/<?php echo $sqlData['gallery1'];?>" height="100" width="200">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Link To Banner 1</label>
<select class="form-control" name="category_id1" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id1']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Menu Banner 2</label>
<input type="file" class="form-control" name="gallery1">
<p style="color:red; ">Size must 545 X 250</p>
<img src="../home_setting/<?php echo $sqlData['gallery1'];?>" height="100" width="200">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Link To Banner 2</label>
<select class="form-control" name="category_id1" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id1']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<h3 class="heading-title">HOME TRENDING CATEGORY</h3><br>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 1</label>
<select class="form-control" name="category_id1" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id1']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery1">
<p style="color:red; ">Size must 545 X 250</p>
<img src="../home_setting/<?php echo $sqlData['gallery1'];?>" height="100" width="200">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title1" value="<?php echo $sqlData['title1'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle1" value="<?php echo $sqlData['subtitle1'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 2</label>
<select class="form-control" name="category_id2" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>" <?php if($sqlCategoryData['id']==$sqlData['category_id2']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery2">
<p style="color:red; ">Size must 545 X 250</p>
<img src="../home_setting/<?php echo $sqlData['gallery2'];?>" height="100" width="200">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title2" value="<?php echo $sqlData['title2'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle2" value="<?php echo $sqlData['subtitle2'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 3</label>
<select class="form-control" name="category_id3" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id3']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery3">
<img src="../home_setting/<?php echo $sqlData['gallery3'];?>" height="100" width="200">
<p style="color:red; ">Size must 545 X 250</p>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title3" value="<?php echo $sqlData['title3'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle3" value="<?php echo $sqlData['subtitle3'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 4</label>
<select class="form-control" name="category_id4" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id4']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery4">
<img src="../home_setting/<?php echo $sqlData['gallery4'];?>" height="100" width="200">
<p style="color:red; ">Size must 545 X 250</p>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title4" value="<?php echo $sqlData['title4'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle4" value="<?php echo $sqlData['subtitle4'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 5</label>
<select class="form-control" name="category_id5" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id5']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery5">
<img src="../home_setting/<?php echo $sqlData['gallery5'];?>" height="100" width="200">
<p style="color:red; ">Size must 545 X 250</p>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title5" value="<?php echo $sqlData['title5'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle5" value="<?php echo $sqlData['subtitle5'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category 6</label>
<select class="form-control" name="category_id6" >
<option value="">Select Category</option>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if($sqlCategoryData['id']==$sqlData['category_id6']){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Category Image</label>
<input type="file" class="form-control" name="gallery6">
<img src="../home_setting/<?php echo $sqlData['gallery6'];?>" height="100" width="200">
<p style="color:red; ">Size must 545 X 250</p>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title6" value="<?php echo $sqlData['title6'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle6" value="<?php echo $sqlData['subtitle6'];?>" placeholder="Sub Title">
</div>
</div>
</div>
<h3 class="heading-title">HOME ABOUT SECTION</h3><br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword4">About Title</label>
<input type="text" class="form-control" name="about_title" value="<?php echo $sqlData['about_title'];?>" placeholder="About Title">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">About Description</label>
<textarea rows="4" cols="50" class="form-control" name="about_description" placeholder="About Description"><?php echo $sqlData['about_description'];?></textarea>
</div>
</div>
</div>
<h3 class="heading-title">HOME DISCOUNT SECTION</h3><br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword4">DISCOUNT TITLE</label>
<input type="text" class="form-control" name="discount_title" value="<?php echo $sqlData['discount_title'];?>" placeholder="DISCOUNT TITLE">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputCity1">DISCOUNT DESCRIPTION</label>
<?php
$oFCKeditor = new FCKeditor('discount_description');
$oFCKeditor->BasePath = 'fckeditor/';
//set the EnterMode to "br" (overwrites the default configuration from fckconfig.js)
$oFCKeditor->Config['EnterMode'] = 'br';
$oFCKeditor->Value = "";
$oFCKeditor->Value = $sqlData['discount_description'];
$oFCKeditor->Create() ;
?>
</div>
</div>
</div>
<h3 class="heading-title">HOME OUR PRODUCT - CATEGORY SECTION</h3><br>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Title</label>
<input type="text" class="form-control" name="title7" value="<?php echo $sqlData['title7'];?>" placeholder="Title">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword4">Sub Title</label>
<input type="text" class="form-control" name="subtitle7" value="<?php echo $sqlData['subtitle7'];?>" placeholder="Sub Title">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="exampleInputPassword4">Product Count</label>
<input type="text" class="form-control" name="product_count" value="<?php echo $sqlData['product_count'];?>" placeholder="product Count">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword4">Category Selector</label>
<select class="form-control multiselect-select-all-filtering" name="category_id7[]" multiple="multiple" required>
<?php $sqlCategory = mysqli_query($cn, "select * from `tbl_category` where `status` IN(0,1)");
while($sqlCategoryData = mysqli_fetch_array($sqlCategory)){?>
<option value="<?php echo $sqlCategoryData['id'];?>"<?php if(in_array($sqlCategoryData['id'],$arrayOurProduct)){ echo "selected";}?>><?php echo $sqlCategoryData['name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-success mr-2" name="submit">Submit</button>
</form>
</div>
</div>