Guest User

Untitled

a guest
Dec 4th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.11 KB | None | 0 0
  1. <?php
  2. // Include the required files
  3. include('dbConfig.php');
  4.  
  5. if (isset($_POST['edit']))
  6. {
  7.     $id = $_POST['edit'];
  8.     $image1 = $_POST['image'];
  9.     $url1 = $_POST['url'];
  10.  
  11.    
  12.     mysql_query("UPDATE advertisements SET image = '" . $image1 . "' AND url = '" . $url1 . "' WHERE id = '" . $id . "' LIMIT 1");
  13.     //echo("Updated! Your advertisement has been put in the queue for processing. Please allow 12-48 hours!");
  14. }
  15.  
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html lang="en">
  20.   <head>
  21.     <meta charset="utf-8">
  22.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  23.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  24.     <meta name="description" content="">
  25.     <meta name="author" content="">
  26.     <link rel="shortcut icon" href="./docs-assets/ico/favicon.png">
  27.  
  28.     <title>Advertisement management panel</title>
  29.  
  30.     <!-- Bootstrap core CSS -->
  31.     <link href="./dist/css/bootstrap.css" rel="stylesheet">
  32.  
  33.     <!-- Custom styles for this template -->
  34.     <link href="./dist/sticky-footer-navbar.css" rel="stylesheet">
  35.  
  36.     <!-- Just for debugging purposes. Don't actually copy this line! -->
  37.     <!--[if lt IE 9]><script src="./docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  38.  
  39.     <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  40.     <!--[if lt IE 9]>
  41.       <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  42.       <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  43.     <![endif]-->
  44.   </head>
  45.  
  46.   <body>
  47.  
  48.     <!-- Wrap all page content here -->
  49.     <div id="wrap">
  50.  
  51.       <!-- Fixed navbar -->
  52.       <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  53.         <div class="container">
  54.           <div class="navbar-header">
  55.             <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  56.               <span class="sr-only">Toggle navigation</span>
  57.               <span class="icon-bar"></span>
  58.               <span class="icon-bar"></span>
  59.               <span class="icon-bar"></span>
  60.             </button>
  61.             <a class="navbar-brand" href="#"><?php echo('Username'); ?></a>
  62.           </div>
  63.           <div class="collapse navbar-collapse">
  64.             <ul class="nav navbar-nav">
  65.               <li class="active"><a href="main.php">Home</a></li>
  66.               <li><a href="contact.php">Contact</a></li>
  67.               <li class="dropdown">
  68.                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Management <b class="caret"></b></a>
  69.                 <ul class="dropdown-menu">
  70.                   <li><a href="edit.php">Edit slots</a></li>
  71.                   <li><a href="buy.php">Purchase slots</a></li>
  72.                   <li><a href="rules.html">Rules</a></li>
  73.                   <li class="divider"></li>
  74.                   <li class="dropdown-header">Account</li>
  75.                   <li><a href="acc-d.php">Details</a></li>
  76.                   <li><a href="acc-s.php">Settings</a></li>
  77.                 </ul>
  78.               </li>
  79.             </ul>
  80.           </div><!--/.nav-collapse -->
  81.         </div>
  82.       </div>
  83.  
  84.       <!-- Begin page content -->
  85.       <div class="container">
  86.         <div class="page-header">
  87.           <h1>Manage advertisements</h1>
  88.         </div>
  89.         <p class="lead">
  90.         You have <b>2</b> advertisement slots.<br /><br />
  91.        
  92.         <!-- Edit advertisement(s) -->
  93.         <table class="table table-striped table-bordered table-condensed">
  94.     <thead>
  95.         <tr>
  96.             <th>ID</th>
  97.             <th>Advertisement image URL</th>
  98.             <th>Advertisement URL</th>
  99.             <th>Section</th>
  100.             <th>Enabled</th>
  101.             <th>Save</th>
  102.         </tr>
  103.     </thead>
  104.     <tbody>
  105.         <tr>
  106.        
  107.         <?php
  108.         $getItems = mysql_query("SELECT * FROM ads WHERE owner = 'Usern' ORDER BY id ASC");
  109.  
  110.         while ($item = mysql_fetch_assoc($getItems))
  111.         {
  112.         echo'
  113.         <form method="post">
  114.         <input type="hidden" name="edit" value="' . $item['id'] . '">
  115.    
  116.            <td>' . $item['id'] . '</td>
  117.            <td><input type="text" name="image" class="form-control" value="' . $item['image'] . '" placeholder="http://" required autofocus></td>
  118.            <td><input type="text" name="url" class="form-control" value="' . $item['url'] . '" placeholder="http://website.com" required autofocus></td>
  119.             <td>' . $item['section'] . '</td>
  120.            <td><font color="green"><b>YES</b></font></td>
  121.             <td><button class="btn btn-lg btn-primary btn-block" type="submit">Save</button></td>
  122.        </form></tr>';
  123.         }
  124.         ?>
  125.     </tbody>
  126. </table>
  127.        
  128.         </p>
  129.       </div>
  130.     </div>
  131.  
  132.     <div id="footer">
  133.       <div class="container">
  134.         <p class="text-muted credit">Script coded by <a href="http://static.obbo.in/advert_manager">Obbo.IN</a> | Version 1.0</p>
  135.       </div>
  136.     </div>
  137.  
  138.  
  139.     <!-- Bootstrap core JavaScript
  140.     ================================================== -->
  141.     <!-- Placed at the end of the document so the pages load faster -->
  142.     <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
  143.     <script src="./dist/js/bootstrap.min.js"></script>
  144.   </body>
  145. </html>
Advertisement
Add Comment
Please, Sign In to add comment