Location: PHPKode > projects > Horizon Blogging Software > admin/deleteentry.php
<?php
$time_start = microtime(TRUE);
define('IN_HBS',TRUE);
include("../inc/include.php");
?>
<?php include("password_protect.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HBS Administrative Control Panel</title>
<script language="javascript" type="text/javascript" src="../inc/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	mode : "textareas"
});
</script>
</head>

<?php include ("default_style.css"); ?>

<body>
<div align="center"><img src="images/header.png" />
</div>
<table id="table" align="center">
<tr>
<td id="menu">
<?php include ("navigation.php"); ?>
</td>
<td id="content">

<table width="100%">
<tr>
  <td style="background-color:#FFFFD9; border: #FFFFB7 1px solid;">
  To delete an entry, click the check-box next to the post you want deleted, and then click "Delete selected". Warning! This is official, and you cannot "un-delete" posts.<br /><br />
<?php
db();

if (isset($_POST['multi_del']))
{
	foreach ($_POST['cdel_id'] as $id)
	{
		$result = mysql_query("DELETE FROM " . $mysql["db_prefix"] . "main WHERE id='".(int)$id."'") or print ("Can't delete entry.<br />" . mysql_error());
	}
}

$result = mysql_query("SELECT timestamp, id, title FROM " . $mysql["db_prefix"] . "main ORDER BY id DESC");

if (!(mysql_num_rows($result)>0))
{
	echo 'There are no posts in your blog';
}
else
{
echo '<form method="POST"><input type="hidden" value="TRUE" name="multi_del" />';
while($row = mysql_fetch_array($result)) {
    $date  = date("l F d Y",$row['timestamp']);
    $id = $row['id'];
    $title = strip_tags(stripslashes($row['title']));

    if (strlen($title) >= 50) {
        $title = substr($title, 0, 50);
        $title = $title . "...";
    }
    echo "	
	<input type=\"checkbox\" name=\"cdel_id[$id]\" value=\"$id\"> <b>$date</b> - "  . $title . "<br />\n";


//if (isset($_GET['del_id'])) {
//    $ids = join ("','", $_GET['del_id']);
//    $sql = "DELETE FROM" . $mysql["db_prefix"] . "WHERE id IN ('$ids')";
//    echo $sql;
//}

}
echo "<input type='submit' name='action' value='Delete selected'></form>";
}

mysql_close();

?>

</td>
</tr>
</table>

</td>
</table>
<?php include("footer.php");?>
</body>
</html>
Return current item: Horizon Blogging Software