Advertisement
Guest User

adminindex.php

a guest
Apr 9th, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.89 KB | None | 0 0
  1. <?php
  2. // Make sure we track state
  3. session_start();
  4. // Get the db
  5. include("../db.php");
  6.  
  7. if (isset($_POST['title'])) {
  8.     if (isset($_GET['update'])) {
  9.         $sql = 'update content ' .
  10.             'set content_title="' . $_POST['title'] . '", ' .
  11.             'content_subtitle="' . $_POST['subtitle'] . '", ' .
  12.             'content_icon="' . $_POST['icon'] . '", ' .
  13.             'content_image="' . $_POST['image'] . '", ' .
  14.             'content_teaser="' . $_POST['teaser'] . '", ' .
  15.             'category_id="' . $_POST['category'] . '", ' .
  16.             'content_body = "' . preg_replace('/"/', '\"', $_POST['body']) . '" ' .
  17.             'where content_id = ' . $_GET['update'];
  18.        
  19.     }
  20.     else {
  21.         $sql = 'insert into content ' .
  22.             'set content_title="' . $_POST['title'] . '", ' .
  23.             'content_subtitle="' . $_POST['subtitle'] . '", ' .
  24.             'content_icon="' . $_POST['icon'] . '", ' .
  25.             'content_image="' . $_POST['image'] . '", ' .
  26.             'content_teaser="' . $_POST['teaser'] . '", ' .
  27.             'category_id="' . $_POST['category'] . '", ' .
  28.             'content_body = "' . preg_replace('/"/', '\"', $_POST['body']) . '"';
  29.     }
  30.     mysql_query($sql);
  31. }
  32. if (isset($_GET['delete'])){
  33.     $sql = 'delete from content where content_id = "' . $_GET['id'] . '"';
  34.     mysql_query($sql);
  35. }
  36.  
  37. #syslog(LOG_INFO, 'Admin index page called.');
  38.  
  39. // Ensure auth
  40. include("auth.php");
  41.  
  42. ?><!DOCTYPE html>
  43. <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  44. <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
  45. <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
  46. <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
  47.     <head>
  48.         <!-- BASICS -->
  49.         <meta charset="utf-8">
  50.         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  51.         <title>LAMPSecLabs</title>
  52.         <meta name="description" content="Amoeba free one page responsive bootstrap site template">
  53.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  54.         <link rel="stylesheet" type="text/css" href="../css/isotope.css" media="screen" /> 
  55.         <link rel="stylesheet" href="../js/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
  56.         <link rel="stylesheet" href="../css/bootstrap.css">
  57.         <link rel="stylesheet" href="../css/bootstrap-theme.css">
  58.         <link rel="stylesheet" href="../css/style.css">
  59.         <!-- skin -->
  60.         <link rel="stylesheet" href="skin/default.css">
  61.     </head>
  62.      
  63.     <body>
  64.         <section id="header" class="appear"></section>
  65.         <?php include_once("inc/navbar.php");?>
  66. <!-- services -->
  67.         <section id="section-services" class="section pad-bot30 bg-white">
  68.         <div class="container">
  69.        
  70.             <div class="row mar-bot40">
  71.                 <div class="col-lg-4" >
  72.                     <div class="align-center">
  73.                         <i class="fa fa-code fa-5x mar-bot20"></i>
  74.                         <h4 class="text-bold">Content</h4>
  75.                         <p><!-- Content area -->
  76.                         <div id="content" style="text-align: left">
  77.                         <a href="add_edit.php">Add new content</a>
  78.                         <ol>
  79.                         <?php
  80.                           $result = mysql_query('select * from content');
  81.                           while($row = mysql_fetch_assoc($result)) {
  82.                             print '<li><a href="add_edit.php?id=' . $row['content_id'] . '">' . $row['content_title'] . '</a>';
  83.                             print ' [<a href="index.php?id=' . $row['content_id'] . '&delete=yes">del</a>]';
  84.                             print '</li>';
  85.                           }
  86.                         ?>
  87.                         </ol>
  88.                         </div>
  89.                         </p>
  90.                     </div>
  91.                 </div>
  92.                    
  93.                 <div class="col-lg-4" >
  94.                     <div class="align-center">
  95.                         <i class="fa fa-gears fa-5x mar-bot20"></i>
  96.                         <h4 class="text-bold">Configuration</h4>
  97.                         <p>
  98.                         <a href="logs.php">Review access logs</a>
  99.                         </p>
  100.                     </div>
  101.                 </div>
  102.            
  103.                 <div class="col-lg-4" >
  104.                     <div class="align-center">
  105.                         <i class="fa fa-user fa-5x mar-bot20"></i>
  106.                         <h4 class="text-bold">Users</h4>
  107.                         <p>
  108.                         <a href="users.php">Users</a>
  109.                         </p>
  110.                     </div>
  111.                 </div>
  112.            
  113.             </div> 
  114.  
  115.         </div>
  116.         </section>
  117. <?php include('inc/footer.php');?>
  118. <?php mysql_close($conn);?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement