Below is a script that you can "delete" posts without an admin panel, you use the URL and $_GET[''] instead. The idea is to make removing posts as easy as possible from any computer without bothering with the admin panel.
Features:- No admin panel required.
- All "deleted" posts remain in the database and can be restored by simply changing post status back to the default value of 1.
- All individual posts have an anchor link. Good for the user who may want to email a link to the post and bookmarking.
How it works:- You notice a problem post to remove, in this example post 0003.
- Click the posts anchor link to display the post id in the URL. index.php?post=0003#0003
- Replace the #0003 with your delete password. index.php?post=0003password
- Reload the page.
- If your delete password is a correct match then the row status is changed to 0.
- Only posts with a status of 1 will display.
PHP Code:
<?php
if (isset($_GET['post'])){
$post = $_GET['post'];
$passWord = substr($post, -8); // last 8 characters.
if ($passWord == "password") {
$postId = substr($post,0,4); // first 4 characters.
mysql_query("UPDATE posts SET status=0 WHERE id=$postId");
}
}
$sql = mysql_query("SELECT * FROM posts WHERE status = '1'");
while($row = mysql_fetch_array($sql)){
echo "<a name=\"$row[0]\"></a>\n";
echo "<a href=\"index.php?post=$row[0]#$row[0]\">$row[0]</a><br>\n";
echo "$row[1]<br><hr>";
}
?>
-----