Location: PHPKode > projects > Free Blog Creator > freeblog/article.php
<?php
require("header.php");
?>
<SCRIPT TYPE="text/javascript" SRC="list.js"></SCRIPT>

Menu &gt; Manage Entries<br><br><br>



<?php
if($_POST["Remove"]){

$flag = $_POST["flag"];


foreach ($flag as $value){

$val=explode(":",$value);

$Log=@file("./log/entry/$val[1].cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode("<>",$Log[$i]);
if($line[0]==$val[0]){
array_splice($Log,$i,1);
}

}
$fp=fopen("./log/entry/$val[1].cgi","w");
flock($fp, LOCK_EX);
foreach($Log as $line)fputs($fp,$line);	
fclose($fp);

$Log=@file("./log/comment/$val[1].cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode("<>",$Log[$i]);
if($line[0]==$val[0]){
array_splice($Log,$i,1);
$flag = 1;
}
}
if($flag){
$fp=fopen("./log/comment/$val[1].cgi","w");
flock($fp, LOCK_EX);
foreach($Log as $line)fputs($fp,$line);	
fclose($fp);
}
$Log=@file("./log/trackback/$val[1].cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode("<>",$Log[$i]);
if($line[0]==$val[0]){
array_splice($Log,$i,1);
$flag = 1;
}
}
if($flag){
$fp=fopen("./log/trackback/$val[1].cgi","w");
flock($fp, LOCK_EX);
foreach($Log as $line)fputs($fp,$line);	
fclose($fp);
}

}


}
?>


<?php
$updir = "./log/entry/";
$dir_file = opendir( $updir );
while (false !== ($file_name = readdir($dir_file))) {
if(is_file("$updir/$file_name") && $file_name != "." && $file_name != ".."){

$dirlist[]=str_replace(".cgi","",$file_name);

}        
}
closedir( $dir_file );
?>




<table width="880">
<tr><td>
<form name="Select" action="#">
<?php
echo "<select name='selectMenu' onchange='hope()' style='width:120px;'>";
for($i=sizeof($dirlist)-1;$i>=0;$i--){

$Selected="";

if($_GET["hopetime"]==$dirlist[$i]){
$Selected="selected";
}

echo "<option value='?hopetime=$dirlist[$i]' $Selected>$dirlist[$i]</option>";
}
echo "</select>";
?>
</form>
</td>
</tr>
</table>

<form action="" method="POST" name="form_list"><table width="475">
<td><input type="button" value="Check All" id="keyh1" onClick="BoxChecked(true);"><input type="reset" value="Uncheck All" id="keyh1" onClick="BoxChecked(false);"></td>
<td align='right'><input type="hidden" name="Remove" value="">With selected: <a href="javascript:document.form_list.submit();" onclick="document.form_list.Remove.value='Remove';">Delete</a>&nbsp;&nbsp;&nbsp;</td>
</table>

<?php
echo "<table width='475' border='0' cellspacing='1' bgcolor='#BBBBBB'>";
echo "<tr><td bgcolor='#ffffff' nowrap width='1%'></td><td align='center' bgcolor='#ffffff' nowrap width='8%'>Date</td><td align='center' bgcolor='#ffffff' nowrap width='10%'>Title</td><td align='center' bgcolor='#ffffff' nowrap width='5%'>Stat.</td><td align='center' bgcolor='#ffffff' nowrap width='5%'>Comments</td><td align='center' bgcolor='#ffffff' nowrap width='5%'>Tb.</td></tr>";
$Rows=10;
if($_POST['p']){
$P=$_POST["p"];
}
else{
$P=0;
}
$num = $P * $Rows;

if(!$_GET["hopetime"]){
$year = $dirlist[sizeof($dirlist)-1];
}
if($_GET["hopetime"]){
$year = $_GET["hopetime"];
}
if($year){
$log = file("./log/entry/$year.cgi");

$start = sizeof($log)-$num-1;
$end = $start - $Rows;

for($i=sizeof($log);$i>=0;$i--){

if($i > $start) continue;
if($i <= $end)  break;

$line=explode("<>",$log[$i]);
$sid=$line[0];
$name=$line[1];
$base=$line[2];
$status=$line[3];
$comment=$line[4];
$trackback=$line[5];
$datetime=$line[6];
$year=$line[7];
$entryym=$line[8];
$track=$line[9];

if($status == 2){
$stat = "Pub.";
}
if($status == 1){
$stat = "Draft";
}
$cLog = 0;
$tLog = 0;
$Log1 = @file("./log/comment/$year.cgi");
for($c=0;$c<sizeof($Log1);$c++){
$cline=explode("<>",$Log1[$c]);
if($cline[1]==$sid){
$cLog++;
}
}
$Log2 = @file("./log/trackback/$year.cgi");
for($t=0;$t<sizeof($Log2);$t++){
$tline=explode("<>",$Log2[$t]);
if($tline[1]==$sid){
$tLog++;
}
}
echo "<tr><td bgcolor='#ffffff' nowrap width='1%'><input type='checkbox' name='flag[]' value='$sid:$year'></td><td align='center' bgcolor='#ffffff' nowrap>$datetime</td><td bgcolor='#ffffff' nowrap><a href='base.php?sid=$sid&entryym=$entryym'>$name</a></td><td align='center' bgcolor='#ffffff' nowrap>$stat</td><td align='right' bgcolor='#ffffff' nowrap>$cLog</td><td align='right' bgcolor='#ffffff' nowrap>$tLog</td></tr>";
}
}
?>
</table></FORM>
<table>
<?php
        if($P>0){
                $Prev=$P-1;
                $PrevPage="<td><form action='' method='POST'><INPUT type='hidden' name='rows' value='$Rows'><INPUT type='hidden' name='p' value='{$Prev}'><input type='submit' name='back' value='BACK' id='keyh1'></form></td>";
        }

$Size=sizeof($log);
        if($Size/$Rows-1>$P){
                $Next=$P+1;
                $NextPage="<td><form action='' method='POST'><INPUT type='hidden' name='rows' value='$Rows'><INPUT type='hidden' name='p' value='{$Next}'><input type='submit' name='next' value='NEXT' id='keyh1'></form></td>";
        }


echo "$PrevPage $NextPage";
?>
</table>






<?php
require("footer.php");
?>
Return current item: Free Blog Creator