|
Server IP : 2a02:4780:11:1017:0:31f1:b895:8 / Your IP : 216.73.216.163 Web Server : LiteSpeed System : Linux in-mum-web917.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u837925013 ( 837925013) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u837925013/domains/tech2wizard.com/public_html/admin/images/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
$page='faq';
$page1='';
include('inc/sidebar.php') ;
if(isset($_GET['del'])){
$id = $_GET['del'];
$del = mysqli_query($con,"delete from faq where id = '$id'");
if($del){
echo "<script type='text/javascript'>window.location=\"faq.php\";</script>";
}
}
if(isset($_GET['act'])){
$id = $_GET['act'];
$act = mysqli_query($con,"UPDATE `faq` SET `status` = '0' where id = '$id'");
if($act){
echo'<div id="hide-toast"class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-body alert">
<i class="fa fa-warning"></i> DeActivated.<i class="fa fa-close"id="close"></i>
</div>
</div>';
echo "<script type='text/javascript'>window.location=\"faq.php\";</script>";
}
}
if(isset($_GET['ina'])){
$id = $_GET['ina'];
$ina = mysqli_query($con,"UPDATE `faq` SET `status` = '1' where id = '$id'");
if($ina){
echo'<div id="hide-toast"class="toast" role="success" aria-live="assertive" aria-atomic="true">
<div class="toast-body success">
<i class="fa fa-warning"></i> Activated.<i class="fa fa-close"id="close"></i>
</div>
</div>';
echo "<script type='text/javascript'>window.location=\"faq.php\";</script>";
}
}
if(isset($_REQUEST['datafrmSubmit'])){
if($_REQUEST['datafrmSubmit'] == 'Submit'){
date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30)
$sql_insert = "insert into faq set question = '".str_replace("'", "\'", $_REQUEST['question'])."',faq = '".str_replace("'", "\'", $_REQUEST['faq'])."',category = '".$_REQUEST['category']."',date = '".date("Y-m-d h:i:s")."', status = '1'";
$query_insert = mysqli_query($con, $sql_insert);
if($query_insert){
echo'<div id="hide-toast"class="toast" role="success" aria-live="assertive" aria-atomic="true">
<div class="toast-body success">
<i class="fa fa-warning"></i> Added.<i class="fa fa-close"id="close"></i>
</div>
</div>';
echo "<script type='text/javascript'>window.location=\"faq.php\";</script>";
}
}
if($_REQUEST['datafrmSubmit'] == 'Update'){
date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30)
$sql_insert = "UPDATE faq set question = '".str_replace("'", "\'", $_REQUEST['question'])."',faq = '".str_replace("'", "\'", $_REQUEST['faq'])."',category = '".$_REQUEST['category']."' WHERE id='".$_REQUEST['id']."'";
$query_insert = mysqli_query($con, $sql_insert);
if($query_insert){
echo'<div id="hide-toast"class="toast" role="success" aria-live="assertive" aria-atomic="true">
<div class="toast-body success">
<i class="fa fa-warning"></i> Added.<i class="fa fa-close"id="close"></i>
</div>
</div>';
echo "<script type='text/javascript'>window.location=\"faq.php\";</script>";
}
}
}
?>
<!-- navbar-wrapper start -->
<div class="body-wrapper">
<div class="bodywrapper__inner">
<div class="row align-items-center mb-30 justify-content-between">
<div class="col-lg-4 col-sm-6">
<h6 class="page-title">All Faq's</h6>
</div>
<div class="col-lg-8 col-sm-6 text-sm-right mt-sm-0 mt-3 right-part">
<div class="d-flex flex-wrap justify-content-end flex-gap-8">
<button type="button" class="btn btn--primary exampleModal" data-modal_title="Add faq"data-toggle="modal" data-target="#exampleModal"style="height: 38px;"><i class="fa fa-plus"></i>Add New</button>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body p-0">
<div class="table-responsive--md table-responsive">
<table id="example"class="table table--light style--two table-striped">
<thead>
<tr>
<th>SL</th>
<th>Question</th>
<th>Category</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sql= "SELECT * FROM faq ORDER BY id DESC";
$qry= mysqli_query($con,$sql);
$i=0;
while($data= mysqli_fetch_array($qry))
{ $i++;
?>
<tr>
<td data-label="SL"><?php echo $i; ?></td>
<td data-label="Name"><?php echo $data['question']; ?></td>
<td data-label="Name"><?php echo $data['category']; ?></td>
<td data-label="Action">
<?php if($data['status']==1){ ?>
<button onclick="location.reload();location.href='faq.php?act=<?php echo $data['id'];?>'" type="button" class="icon-btn btn-success">ACTIVE</button>
<?php }else{ ?>
<button onclick="location.reload();location.href='faq.php?ina=<?php echo $data['id'];?>'" type="button" class="icon-btn btn-danger">DEACTIVE</button>
<?php } ?>
<button class="icon-btn edit" id="<?php echo $data['id'];?>" >EDIT</button>
<a href="faq.php?del=<?php echo $data['id'];?>" onclick="return confirm('Are you sure you want to delete this?');"type="button" class="icon-btn btn-danger">DELETE</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Faq's</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div id="ShowData">
<form method="post" action="" name="datafrm" id="datafrm" enctype="multipart/form-data">
<input type="hidden" name="id"id="id" value="" />
<div class="modal-body">
<div class="form-group">
<label class="form-control-label font-weight-bold">Category<span class="text-danger">*</span></label>
<select type="text" class="form-control" id="category" name="category" required="">
<option vlaue="Booking">Booking</option>
<option vlaue="The Repair">The Repair</option>
<option vlaue="The Tech wizardry Gurantee">The Tech wizardry Gurantee</option>
<option vlaue="Where is tech wizardry">Where is tech wizardry</option>
</select>
</div>
<div class="form-group">
<label class="form-control-label font-weight-bold">Question<span class="text-danger">*</span></label>
<input type="text" class="form-control" placeholder="Question" value=""id="question" name="question" required="" />
</div>
<div class="form-group">
<label class="form-control-label font-weight-bold">Faq's<span class="text-danger">*</span></label>
<textarea name="faq"required class="summernote1"></textarea>
</div>
<div class="status"></div>
</div>
<div class="modal-footer">
<input type="submit" name="datafrmSubmit" id="datafrmSubmit"value="Submit"class="btn btn--primary w-100">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- bodywrapper__inner end -->
</div>
<!-- body-wrapper end -->
</div>
<!-- body-wrapper end -->
</div>
<!-- jQuery library -->
<script>
$(document).ready(function() {
$(document).on('click', '.edit', function() {
var id = $(this).attr("id");
if (id != '') {
$.ajax({
url: "inc/faq.php",
method: "POST",
data: {
id: id,type:1
},
success: function(data) {
$('#ShowData').html(data);
$('#exampleModalLabel').html('Update Faq');
$('#exampleModal').modal('show');
}
});
}
});
});
</script>
<?php include('inc/footer.php') ?>