Location: PHPKode > projects > Scriobai CMS > Scriobai1.6.4/scriobaicms/cms/del.php
<?php

require_once('functions.php');

is_login();

csrf_attemp();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<link rel="stylesheet" type="text/css" href="../style.css">
	<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
	<title>Scriobai / Delete Post</title>
	<style type="text/css">
	<!--
	table
	{
	border-collapse:collapse;
	}
	table,th, td
	{
	border: 1px solid black;
	}
	-->
	</style>
</head>

<body>
<table bgcolor="#f57900" width="100%">
	<tbody>
    <tr>
		<td>
			<div align="left"><a href="manage.php" style="text-decoration: none;"><img style="width: 34px; height: 33px;" border="0" src="img_functions/arrow_left.png" alt="<==="></a></div>
		</td>
		<td>
			<div align="center"><font color="#4b4b4b"><?php $time = date("H:i:s"); $date = date("d/m/Y"); echo "<b>Today</b>: $date <b>time</b>: $time"; ?></font></div>
		</td>
		<td>
			<div align="right"><img style="width: 34px; height: 33px;" src="../img/yacumana.png" alt="../img/yacumana.png"></div>
		</td>
	</tr>
	</tbody>
</table>

<br>

<div style="background-color: rgb(51, 0, 204);">
<table width="100%">
	<tbody>
    <tr>
		<td>
			<img src="img_functions/remove.png">&nbsp;<font color="white"><big>Delete a post</big></font>
		</td>

	</tr>
	<tr>
		<td>
		<?php
		$db     = "../db/*.html";
		$path_1 = glob( $db );
		if ( $path_1 != 0 ) {
			
			$path       = "../db/";
			$dir_handle = @opendir($path) or die("Can't open the directory $path");
			
			echo "<font color=\"white\">Watch the files post in the db <font color=\"red\"><b>$path</b></font></font><br />";
			
			while ( $file = readdir( $dir_handle ) ) {
				
				if( $file!="." && $file!=".." )
				
				echo "<br><a href='$path$file' target=\"_blank\">$file</a> <font color=\"yellow\">-</font> ";
				
				$post_content = file_get_contents("../db/$file");
	
				if (preg_match("/style=\"text-decoration: none\">(.*?)<\/a><\/h1>/", $post_content, $out))
				{
					echo '<font color="red"><b>'.$out[1].'</b></font><br>';
				}
			}
			closedir( $dir_handle );
		}
		elseif ( $path_1 == 0 )
		{
			echo "<font color=\"red\">no post in the <b>/db/</b> before delete a post, you must create a post...</font>";
		}
		?>
		</td>
	</tr>
	<tr>
		<td>
			<br>
			<form method="post" action="del.php"><font color="white">Insert the number of post: <b>(Only numbers)</b> <input size="20" name="numid" type="text">.html</font><br>
			<br>
			<?php echo "<input name='sid' type='hidden' value='$_COOKIE[sid]'>"; ?>
			<input value="Delete" type="submit"><br>
			<br>
			</form>
		</td>
	</tr>
	</tbody>
</table>

<?php
$num  = htmlspecialchars( $_POST['numid'] );
$dira = "comment_$num/";
if ( !empty( $_POST['numid'] ) )
{
	if ( !file_exists("../db/$num.html") )
	{
		echo "<font color=\"white\"><b>The file doesn't exists in the /db/</b></font>";
	} else {
		
		@unlink("../db/$num.html");
		@remove_dir_obj("../comments/".$dira);
		echo "<font color=\"white\"><b>Post successfully deleted</b></font>";
	}
}
?>

</div>

<br>

<div align="center"><font color="yellow"><i>Scriobai CMS is Free software under the GNU/GPL license</i></font></div>
<br>

</body>
</html>
Return current item: Scriobai CMS