%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_358eb648/admin/manage_service/ |
Upload File : |
<?php
include("../function.php");
if($_SESSION['admin_id']==""){
header('location:../login.php');
}
$login_tbl=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM admin WHERE admin_id='".$_SESSION['admin_id']."'"));
// Sidebar strat
include('../include/sidebar.php');
// Sidebar wrap
/*error_reporting(E_ALL);
ini_set('display_errors',1)*/
?>
<!-- [ Main Content ] start -->
<section class="pcoded-main-container">
<div class="pcoded-content">
<!-- [ breadcrumb ] start -->
<div class="page-header">
<div class="page-block">
<div class="row align-items-center">
<div class="col-md-12">
<div class="page-header-title">
<div class="card-header d-flex justify-content-between">
<button class="btn btn-info btn-sm btn-round has-ripple"><i class="feather icon-edit"></i> Add | Service</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- [ breadcrumb ] end -->
<!-- [ Main Content ] start -->
<div class="row">
<div class="col-md-12">
<div class="card">
<!-- <div class="card-header d-flex justify-content-between">
</div> -->
<div class="card-body">
<?php if(isset($_SESSION['message'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<i class="feather icon-thumbs-up text-success"></i> <strong class="text-dark">'.$_SESSION['message'].'</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['message']);
?>
<?php if(isset($_SESSION['error'])){
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
<i class="feather icon-alert-triangle text-danger"></i> <strong class="text-dark">'.$_SESSION['error'].'</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error']);
?>
<?php if(isset($_SESSION['error_message'])){
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
<i class="feather icon-alert-triangle text-danger"></i> <strong class="text-dark">'.$_SESSION['error_message'].'</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error_message']);
?>
<form method="POST" enctype="multipart/form-data" autocomplete="off" name="AddProduct"
>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="form-label" for="name">News Category</label>
<select name="category_id" class="form-select">
<option selected-disabled>Please Select Cateory</option>
<?php
$query=mysqli_query($conn,"SELECT * FROM news_category ORDER BY ID DESC");
while($fetch_row=mysqli_fetch_array($query)){
?>
<option value="<?=$fetch_row['id']?>"><?=$fetch_row['title']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="name">Name</label>
<input type="text" name="name" class="form-control" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="pos_date">Date</label>
<input type="date" name="pos_date" class="form-control" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="title1">Title</label>
<input type="text" name="title1" class="form-control" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="title1_arabic">Heading</label>
<input type="text" name="title1_arabic" class="form-control" required>
</div>
</div>
<div class="col-md-6 d-none">
<div class="form-group">
<label class="form-label" for="about1">Short Description</label>
<textarea id="editor1" name="about1"></textarea>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label class="form-label" for="about1_arabic">Description</label>
<textarea id="editor2" name="about1_arabic"></textarea>
</div>
</div>
<div class="col-md-6 d-none">
<div class="form-group">
<label class="form-label" for="about2">Description</label>
<textarea id="editor3" name="about2"></textarea>
</div>
</div>
<div class="col-md-6 d-none">
<div class="form-group">
<label class="form-label" for="about2_arabic"> Description Arabic</label>
<textarea id="editor4" name="about2_arabic"></textarea>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label class="form-label" for="status">Status</label>
<select class="form-select" name="status" required>
<option value="" >Please select status</option>
<option value="1">Show</option>
<option value="0">Hide</option>';
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="image1">Front Image</label>
<input type="file" name="image1" id="picture" class="form-control">
<p id="error1" style="display:none; color:#FF0000;">
Invalid File Format! File Format Must Be JPG, JPEG, PNG .
</p>
<p id="error2" style="display:none; color:#FF0000;">
File size must be less than 20MB
</p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label" for="image2"> Detail Page Image</label>
<input type="file" name="image2" id="picture1" class="form-control">
<p id="error3" style="display:none; color:#FF0000;">
Invalid File Format! File Format Must Be JPG, JPEG, PNG .
</p>
<p id="error4" style="display:none; color:#FF0000;">
File size must be less than 20MB
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<input name="add" type="submit" class="btn btn-danger" value="Add">
<a class="btn btn-secondary" class="text-white" href="show.php?page=service">Back</a>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- [ form-element ] end -->
</div>
<!-- [ Main Content ] end -->
</div>
</section>
<!-- Required Js -->
<?php include('../include/footer.php'); ?>
<!-- Insert data start --->
<?php
if(isset($_POST['add'])){
$category_id=$_POST['category_id'];
$category_id=str_replace("'", "\'", $category_id);
$name=$_POST['name'];
$name=str_replace("'", "\'", $name);
$pos_date=$_POST['pos_date'];
$pos_date=str_replace("'", "\'", $pos_date);
$title1=$_POST['title1'];
$title1=str_replace("'", "\'", $title1);
$title1_arabic=$_POST['title1_arabic'];
$title1_arabic=str_replace("'", "\'", $title1_arabic);
$about1=$_POST['about1'];
$about1=str_replace("'", "\'", $about1);
$about1_arabic=$_POST['about1_arabic'];
$about1_arabic=str_replace("'", "\'", $about1_arabic);
$about2=$_POST['about2'];
$about2=str_replace("'", "\'", $about2);
$about2_arabic=$_POST['about2_arabic'];
$about2_arabic=str_replace("'", "\'", $about2_arabic);
$status=$_POST['status'];
$genrate_url=create_url($name);
$slug=$genrate_url;
$file_name1=$_FILES['image1']['name'];
$file_tmp1=$_FILES['image1']['tmp_name'];
$file_ext1=strtolower(end(explode('.',$_FILES['image1']['name'])));
$file_name2=$_FILES['image2']['name'];
$file_tmp2=$_FILES['image2']['tmp_name'];
$file_ext2=strtolower(end(explode('.',$_FILES['image2']['name'])));
if($file_name1!='' && $file_name2==''){
$random_number1 = rand();
$new_file_name1 = $random_number1.'.'.$file_ext1;
$file_path1="../../images/Upload/service/".$new_file_name1;
move_uploaded_file($file_tmp1,$file_path1);
mysqli_query($conn,
"INSERT `service_tbl` SET category_id
`category_id`='$category_id',
`name`='$name',
`pos_date`='$pos_date',
`title1`='$title1',
`title1_arabic`='$title1_arabic',
`about1`='$about1',
`about1_arabic`='$about1_arabic' ,
`about2`='$about2',
`about2_arabic`='$about2_arabic' ,
`image1`='$new_file_name1',
`slug`='$slug',
`status`='$status'")or die(mysqli_error($conn));
echo "<script>window.location='show.php?page=service';</script>";
$_SESSION['message']="Record Insertted successfully";
}else if($file_name1=='' && $file_name2!=''){
$random_number2 = rand();
$new_file_name2 = $random_number2.'.'.$file_ext2;
$file_path2="../../images/Upload/service/".$new_file_name2;
move_uploaded_file($file_tmp2,$file_path2);
mysqli_query($conn,
"INSERT `service_tbl` SET
`category_id`='$category_id',
`name`='$name',
`pos_date`='$pos_date',
`title1`='$title1',
`title1_arabic`='$title1_arabic',
`about1`='$about1',
`about1_arabic`='$about1_arabic' ,
`about2`='$about2',
`about2_arabic`='$about2_arabic' ,
`image2`='$new_file_name2',
`slug`='$slug',
`status`='$status'")or die(mysqli_error($conn));
echo "<script>window.location='show.php?page=service';</script>";
$_SESSION['message']="Record Insertted successfully";
}else if($file_name1!='' && $file_name2!=''){
$random_number1 = rand();
$new_file_name1 = $random_number1.'.'.$file_ext1;
$file_path1="../../images/Upload/service/".$new_file_name1;
move_uploaded_file($file_tmp1,$file_path1);
$random_number2 = rand();
$new_file_name2 = $random_number2.'.'.$file_ext2;
$file_path2="../../images/Upload/service/".$new_file_name2;
move_uploaded_file($file_tmp2,$file_path2);
mysqli_query($conn,
"INSERT `service_tbl` SET
`category_id`='$category_id',
`name`='$name',
`pos_date`='$pos_date',
`title1`='$title1',
`title1_arabic`='$title1_arabic',
`about1`='$about1',
`about1_arabic`='$about1_arabic' ,
`about2`='$about2',
`about2_arabic`='$about2_arabic' ,
`image1`='$new_file_name1',
`image2`='$new_file_name2',
`slug`='$slug',
`status`='$status'")or die(mysqli_error($conn));
echo "<script>window.location='show.php?page=service';</script>";
$_SESSION['message']="Record Insertted successfully";
}else{
mysqli_query($conn,
"INSERT `service_tbl` SET
`category_id`='$category_id',
`name`='$name',
`title1`='$title1',
`title1_arabic`='$title1_arabic',
`about1`='$about1',
`about1_arabic`='$about1_arabic' ,
`about2`='$about2',
`about2_arabic`='$about2_arabic' ,
`slug`='$slug',
`status`='$status'")or die(mysqli_error($conn));
echo "<script>window.location='show.php?page=service';</script>";
$_SESSION['message']="Record Insertted successfully";
}
}
?>
<!-- Insert data warp --->