|
Server IP : 128.199.20.84 / Your IP : 172.69.214.98 Web Server : Apache/2.4.41 (Ubuntu) System : Linux competent-maruti 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.0.20 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0775) : /var/lib/python/../python/../python/../python/../systemd/../../www/html/admin_panel/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include('header.php');
include('left_sidebar.php');
include_once("fckeditor/fckeditor.php");
/* package_visit Start*/
$FCKeditor5 = new FCKeditor('description');
$FCKeditor5->BasePath = 'fckeditor/';
$FCKeditor5->Height = '400px';
$FCKeditor5->Width = '90%';
/* package_visit End*/
$button=@$_GET["mode"]=="edit"? "Update": "Submit";
if(@$_GET["objID"]!="")
{
$CatRs=mysqli_query($con,"select * from tp_service where id='".$_GET["objID"]."'") ;
$CatRow=mysqli_fetch_assoc($CatRs) ;
$description=$CatRow['description'];
/*package_visit Content Start*/
$FCKeditor5->Value = $description;
/*package_visit Content End*/
}
if($_POST["Submit"]=="Update")
{
extract($_POST);
$cQuery="update tp_service set category='".mysqli_real_escape_string($con,$_REQUEST["category"])."',
description='".mysqli_real_escape_string($con,$description)."',
status='".mysqli_real_escape_string($con,$_REQUEST["status"])."',
category_id='".mysqli_real_escape_string($con,$_REQUEST["category_id"])."',
modified_date='".strftime('%Y-%m-%d %H:%M:%S', time())."'";
if($_FILES['image1']['name']!=""){
$image=time()."-".md5(rand())."-".$_FILES['image1']['name'];
if($image!=""){
$cQuery.=",filename ='".$image."'" ;
$target="../file_upload/service/";
$source=$_FILES["image1"]["tmp_name"];
$target=$target.$image;
move_uploaded_file($source,$target) ;
}
}
$cQuery.=" where id='".$_GET["objID"]."'" ;
$RowCons=mysqli_query($con,$cQuery) or die(mysql_error());
if($RowCons)
{
$_SESSION["msg"]="record is updated successfully ";
header("location:view_service.php");
exit() ;
}
}else if(isset($_POST["Submit"])=="Submit")
{
extract($_POST);
$cQuery="insert into tp_service set category='".mysqli_real_escape_string($con,$_REQUEST["category"])."',
description='".mysqli_real_escape_string($con,$description)."',
status='".mysqli_real_escape_string($con,$_REQUEST["status"])."',
category_id='".mysqli_real_escape_string($con,$_REQUEST["category_id"])."',
added_date='".strftime('%Y-%m-%d %H:%M:%S', time())."'";
if($_FILES['image1']['name']!="")
{
$image=time()."-".md5(rand())."-".$_FILES['image1']['name'];
if($image!="")
{
$cQuery.=",filename ='".$image."'" ;
$target="../file_upload/service/";
$source=$_FILES["image1"]["tmp_name"];
$target=$target.$image;
move_uploaded_file($source,$target) ;
}
}
$RowCons=mysqli_query($con,$cQuery) or die(mysql_error());
if($RowCons)
{
$_SESSION["msg"]="One Record Is Inserted ";
header("location:view_service.php");
exit() ;
}
}
?>
<!-- ============================================================== -->
<!-- Page wrapper -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Container fluid -->
<!-- ============================================================== -->
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row page-titles">
<div class="col-md-5 col-8 align-self-center">
<h3 class="text-themecolor">New service</h3>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
<li class="breadcrumb-item active">New service</li>
</ol>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Start Page Content -->
<!-- ============================================================== -->
<!-- Row -->
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">New service</h4>
<form class="form" method="post" action="" enctype="multipart/form-data">
<?php if(isset($_SESSION["msg"]))
{ ?>
<div class="alert alert-danger"> <?php echo $_SESSION["msg"]; ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button>
</div>
<?php unset($_SESSION["msg"]); }
?>
<div class="form-group row">
<label for="example-search-input" class="col-2 col-form-label">Main Category</label>
<div class="col-10">
<select class="custom-select col-12" id="inlineFormCustomSelect" name="category_id" required>
<option value=""> --Select-- </option>
<?php $CatRs2=mysqli_query($con,"select * from tp_category where status='1' order by category_id desc") ;
while($categories=mysqli_fetch_assoc($CatRs2)){?>
<option value='<?php echo $categories['id'];?>' <?php if($CatRow['category_id']==$categories['id']){ echo "Selected";}?>> <?php echo $categories['category_id'];?> - (<?php echo $categories['subcategory'];?>)</option>";
<?php }
?>
</select>
</div>
</div>
<div class="form-group row">
<label for="example-text-input" class="col-2 col-form-label">Image</label>
<div class="col-7">
<input class="form-control" type="file" id="example-file-input" name="image1">
</div>
<div class="col-3">
<?php if(isset($CatRow["filename"])){?>
<img src="../file_upload/service/<?=$CatRow["filename"];?>" height="80">
<?php } ?>
</div>
</div>
<div class="form-group row">
<label for="example-text-input" class="col-2 col-form-label">Description</label>
<div class="col-10">
<?php echo $FCKeditor5->Create(); ?>
</div>
</div>
<div class="form-group row">
<label for="example-search-input" class="col-2 col-form-label">Status</label>
<div class="col-10">
<select class="custom-select col-12" id="inlineFormCustomSelect" name="status" required>
<?php if($CatRow['status']=='1'){ ?>
<option value="1" selected >Active</option>
<option value="0">Deactive</option>
<?php }else if($CatRow['status']=='0'){?>
<option value="0" selected >Deactive</option>
<option value="1" >Active</option>
<?php }else{ ?>
<option value="1" selected>Active</option>
<option value="0">Deactive</option>
<?php } ?>
</select>
</div>
</div>
<input name="Submit" type="hidden" value="<?=$button;?>"/>
<button type="submit" name="submit" class="btn btn-info waves-effect waves-light ">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- End PAge Content -->
<!-- ============================================================== -->
<?php include('footer.php');?>