* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License in GPL.txt for more details. */ define('IN_ADMIN', 1); require_once('common.php'); updateAdminHistory($conn); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['editme'])) { $edit_me_id = htmlentities(Trim($_POST['editme'])); $page_name = Trim($_POST['page_name']); $page_title = Trim($_POST['page_title']); $page_content = $_POST['data']; $query = "UPDATE pages SET last_date='$date', page_name='$page_name', page_title='$page_title', page_content='$page_content' WHERE id='$edit_me_id'"; } else { $page_name = Trim($_POST['page_name']); $page_title = Trim($_POST['page_title']); $page_content = $_POST['data']; $query = "INSERT INTO pages (last_date,page_name,page_title,page_content) VALUES ('$date','$page_name','$page_title','$page_content')"; } mysqli_query($con, $query); $page_name = ""; $page_title = ""; $page_content = ""; } if (isset($_GET['edit'])) { $page_id = trim($_GET['edit']); $sql = "SELECT * FROM pages where id='$page_id'"; $result = mysqli_query($con, $sql); //we loop through each records while ($row = mysqli_fetch_array($result)) { //populate and display results data in each row $page_name = $row['page_name']; $page_title = $row['page_title']; $page_content = $row['page_content']; } } ?> Paste - Pages
Add a Page

'; } ?>

Pages
' . mysqli_error($con) . ' '; } else { echo '
Page deleted.
'; } } $rec_limit = 20; $query = "SELECT count(id) FROM pages"; $retval = mysqli_query($con, $query); $row = mysqli_fetch_array($retval); $rec_count = Trim($row[0]); if (isset($_GET['page'])) { // Get the current page $page = $_GET['page'] + 1; $offset = $rec_limit * $page; } else { // Show first set of results $page = 0; $offset = 0; } $left_rec = $rec_count - ($page * $rec_limit); // Set the specific query to display in the table $sql = "SELECT * FROM pages ORDER BY `id` DESC LIMIT $offset, $rec_limit"; $result = mysqli_query($con, $sql); $no = 1; // Loop through each records while ($row = mysqli_fetch_array($result)) { // Populate and display results data in each row echo ''; echo ''; echo ''; echo ''; $myid = $row['id']; echo ''; echo ''; echo ''; $no++; } echo ''; echo ''; echo '
Date Added Page Name Page Title View Edit Delete
' . $row['last_date'] . '' . $row['page_name'] . '' . $row['page_title'] . '' . " View " . '' . " Edit " . '' . " Delete " . '
'; // Display the pagination echo '
    '; if ($left_rec < $rec_limit) { $last = $page - 2; if ($last < 0) { } else { echo @"
  • Previous
  • "; } } elseif ($page == 0) { echo @"
  • Next
  • "; } elseif ($page > 0) { $last = $page - 2; echo @"
  • Previous
  • "; echo @"
  • Next
  • "; } echo '
'; ?>