Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Post News - ADMINS ONLY</title>
- <meta content="text/html; charset=UTF-8" http-equiv="content-type">
- <link rel="stylesheet" href="style.css" type="text/css">
- </head>
- <center><h1>Post News</h1></center>
- <hr>
- <?php
- error_reporting (E_ALL ^ E_NOTICE);
- include('inc/config.php');
- if($_POST['post'])
- {
- //get data
- $title = $_POST['title'];
- $body = $_POST['body'];
- $date = date("Y-m-d");
- //check for existance
- if ($title&&$body)
- {
- $dbc = mysql_connect("localhost","agger","n24dgeptbm9c") or die(mysql_error());
- $db_select = mysql_select_db("news") or die(mysql_error());
- //insert data
- $insert = mysql_query("INSERT INTO news VALUES ('','$title','$body','$date')") or die(mysql_error);
- die("<center>Your news has been posted.</center>");
- }
- else
- echo "<center>Please fill out title and body<p></center>";
- }
- if($_GET['delete'])
- {
- //get data
- $id = $_GET['id'];
- //check for existance
- if ($id)
- {
- $dbc = mysql_connect("localhost","agger","n24dgeptbm9c") or die(mysql_error());
- $db_select = mysql_select_db("news") or die(mysql_error());
- //delete data
- $delete = mysql_query("DELETE FROM news WHERE id='$id'") or die(mysql_error);
- echo "<center>The news with ID: $id has been deleted.</center>";
- }
- else
- echo "<center>Please fill out the ID<p></center>";
- }
- ?>
- <center>
- <form action='post.php' method='POST'>
- Title:<br>
- <input type='test' name='title'><p>
- Body:<br>
- <textarea rows='6' cols='35' name='body'></textarea><p>
- <input type='submit' name='post' value='Post News'>
- <input type='reset' value='Reset'>
- </form>
- <form action='post.php' method='GET'>
- Delete ID:<br>
- <input type='text' name='id'><p>
- <input type='submit' name='delete' value='Delete News'>
- </form>
- <p>If you need to find out what ID to enter, <br>
- please go to the Control Panel and look in the MySQL Database, <br>
- I'm still working on the feature to lookup at website. <br>
- Thank you for your patience and understanding.</p></center>
- </html>
Add Comment
Please, Sign In to add comment