Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/bond-lounge.com/public_html/admin9120/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/perevoshchikov/summernote-grid@1.0.0/summernote-grid.min.js"></script>
<script>
$(document).ready(function() {
$('#summernote').summernote({
toolbar:[
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview', 'help']],
['insert', ['grid']]
],
grid: {
wrapper: "row",
columns: [
"col-md-12",
"col-md-6",
"col-md-4",
"col-md-3",
]
},
callbacks: {
onGridInsert: null
},
icons: {
grid: "glyphicon glyphicon-th"
}
});
});
</script>
<?php
$title = "projects";
$title_cap = ucfirst($title);
if (isset($_POST['add'])) {
$title1 = $_POST['title'];
$preamble = $_POST['preamble'];
$body = $_POST['body'];
if( ($_FILES["fileField"]["type"]=="") == false ){
$random_id = substr(md5(rand()), 0, 20);
$extension = pathinfo($_FILES["fileField"]["name"], PATHINFO_EXTENSION);
move_uploaded_file( $_FILES['fileField']['tmp_name'], "../site_img/$title/$random_id.$extension");
$picture ="$random_id.$extension";
}
if( ($_FILES["fileField2"]["type"]=="") == false ){
$random_id2 = substr(md5(rand()), 0, 20);
$extension2 = pathinfo($_FILES["fileField2"]["name"], PATHINFO_EXTENSION);
move_uploaded_file( $_FILES['fileField2']['tmp_name'], "../site_img/$title/$random_id2.$extension2");
$picture2 ="$random_id2.$extension2";
}
else{$picture2 = "";}
if( ($_FILES["fileField3"]["type"]=="") == false ){
$random_id3 = substr(md5(rand()), 0, 20);
$extension3 = pathinfo($_FILES["fileField3"]["name"], PATHINFO_EXTENSION);
move_uploaded_file( $_FILES['fileField3']['tmp_name'], "../site_img/$title/$random_id3.$extension3");
$picture3 ="$random_id3.$extension3";
}
else{$picture3 = "";}
if( ($_FILES["fileField4"]["type"]=="") == false ){
$random_id4 = substr(md5(rand()), 0, 20);
$extension4 = pathinfo($_FILES["fileField4"]["name"], PATHINFO_EXTENSION);
move_uploaded_file( $_FILES['fileField4']['tmp_name'], "../site_img/$title/$random_id4.$extension4");
$picture4 ="$random_id4.$extension4";
}
else{$picture4 = "";}
$db_id=0;
$con->set_charset("utf8mb4");
$unique_id = substr(md5(rand()), 0, 10);
$stmt = $con -> prepare("INSERT INTO $title VALUES (?,?,?,?,?,?,?,?,?)");
$stmt -> bind_param('issssssss', $db_id,$unique_id,$title1,$preamble,$body,$picture,$picture2,$picture3,$picture4);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Item successfully added.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";
}
?>
<title><?php echo $company_name; ?>, Admin, <?php echo $title_cap; ?></title>
<style>
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
border: 1px solid #ddd;
font-size:15px;
}
th, td {
text-align: left;
padding: 8px 28px 8px 28px;
}
tr:nth-child(even){background-color: #f2f2f2}
</style>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container"> </div>
</section>
<?php
$stmt_a = $con -> prepare("SELECT id FROM $title");
$stmt_a -> execute();
$stmt_a -> store_result();
$stmt_a -> bind_result($aa);
$numrows_a = $stmt_a -> num_rows();
?>
<section id="contact" class="contact inner-page">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2 style=''><?php echo $title_cap ?></h2>
<p><span style='color:black;'>Number of <?php echo $title_cap ?> <?php echo"($numrows_a)"; ?></span><br/>
</p>
</div>
<div class="row">
<div class="col-lg-8 mt-5 mt-lg-0 d-flex align-items-stretch">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
<div class='validate'><?php echo $error; ?></div>
<div class="form-row">
<div class="form-group col-md-12">
<input type="text" name="title" class="form-control" placeholder="Heading" required />
</div>
<div class="form-group col-md-12">
<input type="text" name="preamble" class="form-control" placeholder="Preamble" required />
</div>
<div class="form-group col-md-12">
<textarea name="body" id="summernote" class="form-control" required></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label>Main Image (Required)</label>
<input type='file' name='fileField' class="form-control" required />
</div>
<div class="form-group col-md-6">
<label>Image Slider (Optional)</label>
<input type='file' name='fileField2' class="form-control" />
</div>
<div class="form-group col-md-6">
<label>Image Slider (Optional)</label>
<input type='file' name='fileField3' class="form-control" />
</div>
<div class="form-group col-md-6">
<label>Image Slider (Optional)</label>
<input type='file' name='fileField4' class="form-control" />
</div>
</div>
<div class="text-center">
<button type="submit" name='add'>Save</button>
</div>
</form>
</div>
<div class="col-lg-4 d-flex align-items-stretch"></div>
</div>
<br><br>
<div class="section-title">
<h2 style=''>Uploaded <?php echo $title_cap ?></h2>
</p>
</div>
<div class='row'>
<?php $count=0; $grand_total =0; $details = "_details";
$sql = "SELECT COUNT(id) FROM $title ORDER BY id DESC";
$query = mysqli_query($con, $sql);
$row = mysqli_fetch_row($query);
//here we have the total row count
$rows = $row[0];
//number of results we want per page
$page_rows = 400;
//tells us the page number of our last page
$last = ceil($rows/$page_rows);
//this makes sure last cannot be less than 1
if($last < 1){$last = 1;}
//establish the page num variable
$pagenum = 1;
//Get pageum from $GET if it is present, else its 1
if(isset($_GET['pn'])){
$pagenum = preg_replace('#[^0-9]#', '', $_GET['pn']);
}
//below 1 or more than last page
if($pagenum < 1){
$pagenum = 1;
}else if ($pagenum > $last) {
$pagenum = $last;
}
//this sets the range of rows to query for the chosen pagenum
$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
//grabs one page worth of rows
$sql = "SELECT * FROM $title ORDER BY id DESC $limit ";
$query = mysqli_query($con, $sql);
//this shows the user what page they on and total number
$textline1 = "Messages $rows";
$textline2 = "Page $pagenum of $last";
//establish the pagination controls
$paginationCtrls = "";
//if there is more than one page worth of results
if($last != 1){
if($pagenum > 1){
$previous = $pagenum - 1;
//$paginationCtrls .='<a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Previous</a>  ';
$paginationCtrls .='<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Prev</a></li>';
//render clickable links to the left of target page number
for($i = $pagenum-4; $i < $pagenum; $i++){
if($i > 0){
//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'"></a> ';
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
}
}
}
//render target number bt not link
//$paginationCtrls .= ''.$pagenum.' ';
$paginationCtrls .= '<span class="pagination"><ul><li class="active"><a href="#">'.$pagenum.'</a></li></ul></span>';
//render clickable number links to the right of target number
for($i = $pagenum+1; $i <= $last; $i++){
//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a> ';
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
if($i >= $pagenum+4){
break;
}
}
//this does the same as above, only checking if we are on the last page
if($pagenum != $last) {
$next = $pagenum + 1;
$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'">Next</a></li>';
}
}
if(mysqli_num_rows($query) > 0){
echo"
<div style='overflow-x:auto;'>
<table>
<tr>
<th>No</th>
<th>Name</th>
<th>View Details</th>
</tr>
";
while ($row_back_deals = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$unique_id = $row_back_deals['unique_id'];
$title1 = $row_back_deals['title'];
$count++;
echo"
<tr>
<td>$count</td>
<td>$title1</td>
<td><a href='$title$details.php?u=$unique_id'>View Details</a></td>
</tr>
";
}
echo"</table></div>";
}
else{echo"Nothing found";}
?>
</div>
<div class='double_line'></div>
<div class="row">
<div class="col-md-12">
<ul class="pagination clearfix">
<?php
echo"$paginationCtrls<br/><br/>";
echo "<div class='text_line'>$textline2</div>";
?>
</ul>
</div>
</div>
</div>
</section><!-- End Contact Section -->
<!-- ======= Footer ======= -->
<footer id="footer" style='background:;'>
<div class="container footer-bottom clearfix">
<div class="copyright">
Copyright © <?php $odun=date('Y'); echo $odun; ?> <strong><span><?php echo $company_name; ?></span></strong>. All Rights Reserved
</div>
<div class="credits">
</div>
</div>
</footer><!-- End Footer -->
<a href="#" class="back-to-top"><i class="ri-arrow-up-line"></i></a>
<div id="preloader"style='background:<?php echo $color; ?>;'></div>
<!-- Vendor JS Files -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<script src="assets/vendor/waypoints/jquery.waypoints.min.js"></script>
<script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="assets/vendor/venobox/venobox.min.js"></script>
<script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
<script src="assets/vendor/aos/aos.js"></script>
<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
</body>
</html>