Guest User

Untitled

a guest
Nov 21st, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if (!$_SESSION["valid_user"])
  6.     {
  7.     // User not logged in, redirect to login page
  8.     Header("Location: index.php");
  9.     die;
  10.     }
  11.    
  12. require_once "dbConfig.php";
  13. if (isset($_POST['edit']))
  14. {
  15.     $id = mysql_escape_string($_POST['edit']);
  16.     $image = mysql_escape_string($_POST['image']);
  17.     $url = mysql_escape_string($_POST['url']);
  18.  
  19.    
  20.     mysql_query("UPDATE advertisements SET imgsrc = '" . $image . "' AND url = '" . $url . "' WHERE id = '" . $id . "' LIMIT 1");
  21.     //echo("Updated! Your advertisement has been put in the queue for processing. Please allow 12-48 hours!");
  22. }
  23.  
  24.  
  25. require_once "top.php";
  26.  
  27.  
  28. ?>         
  29. <section id="main" class="column">     
  30.         <article class="module width_full">
  31.             <header><h3>Advertisements</h3></header>
  32.                 <div class="module_content">
  33.                     <p>
  34.     This tool is used to edit your advertisement(s), you are allowed to use ANY image format (including .GIF)! Please note, once you update your advertisement(s), it will be disabled until
  35.     it's reviewed and accepted! This can take up to 12-48 hours to be re-enabled and displayed back on the site.
  36. </p>
  37.  
  38. <h2>Manage ads</h2>
  39.  
  40. <br />
  41.  
  42. <table width="90%" border="1">
  43. <thead>
  44. <tr>
  45.     <td>Image</td>
  46.     <td>URL</td>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <?php
  51.  
  52. $getItems = mysql_query("SELECT * FROM advertisements ORDER BY id ASC");
  53.  
  54. while ($item = mysql_fetch_assoc($getItems))
  55. {
  56.     echo '<tr>
  57.     <form method="post">
  58.     <input type="hidden" name="edit" value="' . $item['id'] . '">
  59.  
  60.     <td><img src="' . $item['imgsrc'] . '"><br /><input type="text" name="image" value="' . $item['imgsrc'] . '"></td>
  61.     <td><input type="text" name="url" value="' . $item['url'] . '"></td>
  62.     <td><input type="submit" value="Save"></td>
  63.     </form>
  64.     </tr>';
  65. }
  66.  
  67. ?>
  68.  
  69. </tbody>
  70. </table>
  71.                 </div>
  72.         </article><!-- end of styles article -->
  73.         <div class="spacer"></div>
  74. </section>
Advertisement
Add Comment
Please, Sign In to add comment