Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (!$_SESSION["valid_user"])
- {
- // User not logged in, redirect to login page
- Header("Location: index.php");
- die;
- }
- require_once "dbConfig.php";
- if (isset($_POST['edit']))
- {
- $id = $_POST['edit'];
- $image = $_POST['image'];
- $url = $_POST['url'];
- var_dump($id);
- var_dump($image);
- var_dump($url);
- mysql_query("UPDATE advertisements SET imgsrc = '" . $image . "' AND url = '" . $url . "' WHERE id = '" . $id . "' LIMIT 1");
- var_dump(mysql_error());
- //echo("Updated! Your advertisement has been put in the queue for processing. Please allow 12-48 hours!");
- }
- require_once "top.php";
- ?>
- <section id="main" class="column">
- <article class="module width_full">
- <header><h3>Advertisements</h3></header>
- <div class="module_content">
- <p>
- 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
- it's reviewed and accepted! This can take up to 12-48 hours to be re-enabled and displayed back on the site.
- </p>
- <h2>Manage ads</h2>
- <br />
- <table width="90%" border="1">
- <thead>
- <tr>
- <td>Image</td>
- <td>URL</td>
- </tr>
- </thead>
- <tbody>
- <?php
- $getItems = mysql_query("SELECT * FROM advertisements ORDER BY id ASC");
- while ($item = mysql_fetch_assoc($getItems))
- {
- echo '<tr>
- <form method="post">
- <input type="hidden" name="edit" value="' . $item['id'] . '">
- <td><img src="' . $item['imgsrc'] . '"><br /><input type="text" name="image" value="' . $item['imgsrc'] . '"></td>
- <td><input type="text" name="url" value="' . $item['url'] . '"></td>
- <td><input type="submit" value="Save"></td>
- </form>
- </tr>';
- }
- ?>
- </tbody>
- </table>
- </div>
- </article><!-- end of styles article -->
- <div class="spacer"></div>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment