Location: PHPKode > projects > eBlog > admin/clear.php
<?php

/**************************************************************************
 *                                                                        *
 *                                                                        *
 *         Solution: eBlog                                                *
 *          Release: 1.7                                                  *
 *             File: admin/clear.php                                      *
 *               By: Emuci inc.                                           *
 *          Website: http://www.emuci.com                                 *
 *        Copyright: (C) 2010 Emcui inc.                                  *
 *                                                                        *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *                                                                        *
 *   This script is NOT freeware and is subjected to Emuci terms of use   *
 *   located in the docs folder.                                          *
 *                                                                        *
 *                                                                        *
 *************************************************************************/


include 'global.php';
if($_SESSION['permission'] == 1){
		
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db($dbname);
	
	$sql="UPDATE eblog_alerts SET comments='0' WHERE id = '1'";
	$result=mysql_query($sql);	
	
	$sql="UPDATE eblog_alerts SET gb='0' WHERE id = '1'";
	$result=mysql_query($sql);	
	
	$sql="UPDATE eblog_alerts SET sub='0' WHERE id = '1'";
	$result=mysql_query($sql);
	
	$sql="UPDATE eblog_alerts SET mails='0' WHERE id = '1'";
	$result=mysql_query($sql);		
	
	
	$thisPageNav = "&nbsp;<img src=\"../images/icons/prev_$blog_dir.gif\">&nbsp;<font face=\"tahoma\" style=\"font-size: 10pt;\">$lang_admin_notifications</font>";
	
	// Quick Links
	$quicklinks = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">

	 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
	 <td><a href=\"todo.php\" title=\"$lang_admin_toDoMenu\" rel=\"gb_page_center[640, 130]\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_toDoMenu</font></a></td>
	 </tr>		
		
	 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
	 <td><a href=\"topics.php?action=add\"   title=\"$lang_admin_addTopic\" rel=\"gb_page_center[640, 500]\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_addTopic</font></a></td>
	 </tr>
	 	 
	 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
	 <td><a href=\"sections.php#add\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_addSection</font></a></td>
	 </tr>
	 	 
	 
	 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
	 <td><a href=\"topics.php#list\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_showTopic</font></a></td>
	 </tr>
	 	 
	 
	 <tr><td valign =\"top\" width=\"22\"><img src=\"../images/icons/icon_bullet.gif\"></td>
	 <td><a href=\"settings.php\"><font style=\"font-size: 0.7em;\" face=\"Tahoma\">$lang_admin_editSettings</font></a></td>
	 </tr>					 					 					 
	 
	 
	 </table>
	";
					
	
	
	$new_entries_list = "<table bordercolor=\"#727272\" style=\"border-collapse: collapse\" width=\"100%\" cellSpacing=\"0\" cellPadding=\"5\"  border=\"1\">
	<tr>
	
	<td width=\"40\" align=\"center\" background=\"../images/icons/disc_bar.gif\">
	<font face=\"tahoma\" size=\"2\" color=\"#ffffff\">$lang_admin_id</font>
	</td>
	
	<td align=\"center\" background=\"../images/icons/disc_bar.gif\">
	<font face=\"tahoma\" size=\"2\" color=\"#ffffff\">$lang_admin_title</font>
	</td>
	
	<td width=\"150\" align=\"center\" background=\"../images/icons/disc_bar.gif\">
	<font face=\"tahoma\" size=\"2\" color=\"#ffffff\">$lang_admin_type</font>
	</td>		
	
	</tr>
	";
	
		$query  = "SELECT * FROM eblog_new ORDER BY id DESC";
		$result = mysql_query($query);	
		$totalResults = 0;	
		while($row = mysql_fetch_array($result, MYSQL_ASSOC))
		{
			$id = $row['id'];
			$uID = $row['uid'];
			$type = $row['type'];
			
			if($type == 1){
			$table = "eblog_comments";
			$toGet = "author";
			$rowType = $lang_admin_searchComment;
			$url = "href=\"topics.php?action=EditComment&id=$uID&GTP=topics.php\" rel=\"gb_page_center[640, 300]\"";
			}
			if($type == 2){
			$table = "eblog_gb";
			$toGet = "title";
			$rowType = $lang_admin_searchGBC;
			$url = "href=\"guestbook.php?action=edit&id=$uID\" rel=\"gb_page_center[640, 300]\"";
			}
			if($type == 3){
			$table = "eblog_contacts";
			$toGet = "email";
			$rowType = $lang_admin_searchContact;
			$url = "href=\"mail.php?action=Edit&id=$uID\" rel=\"gb_page_center[640, 400]\"";
			}
			if($type == 4){
			$table = "eblog_messages";
			$toGet = "title";
			$rowType = $lang_admin_searchMessage;
			$url = "href=\"mail.php?action=Show&id=$uID&sp=0\" rel=\"gb_page_center[640, 500]\"";
			}				
			
			$devider = $totalResults%2;
			
			if($devider==0)
			$bgColor="#f2f2f2";
			else
			$bgColor="#dadada";			
			
			$queryII = "SELECT $toGet FROM $table WHERE id = '$uID'";
			$result2 = mysql_query($queryII);	
			$row2 = mysql_fetch_row($result2);
			$data = $row2[0];									
			
			$new_entries_list = $new_entries_list . "
			<tr bgcolor=\"$bgColor\">
			<td width=\"40\" align=\"center\"><font face=\"tahoma\" size=\"2\">$id</font></td>
			<td><a $url><font face=\"tahoma\" size=\"2\">$data</font></a></td>
			<td width=\"150\" align=\"center\"><font face=\"tahoma\" size=\"2\">$rowType</font></td>
			</tr>  
			";
			$totalResults++;
		}
		
		if($totalResults < 1)
		$new_entries_list = $new_entries_list .  "<tr><td colspan=\"3\" bgcolor=\"#f2f2f2\"><font face=\"tahoma\" size=\"2\">" . $lang_admin_noResults . "</font></td></tr>";
		
		$new_entries_list = $new_entries_list . "</table>";
	
	
	$static_value = array ($blog_dir, $blog_windows_encoding, $lang_admin_adminPanel, "", $blog_slogan, $lang_admin_showHomePage, $lang_admin_link_1, $lang_admin_link_2, $lang_admin_link_3, $lang_admin_link_4, $lang_admin_link_5, $lang_admin_link_6, $lang_admin_link_7, $lang_admin_sync, $lang_admin_search,
	
	$lang_admin_quickLinks,$quicklinks,$lang_admin_readDocumentation,
	$lang_admin_notifications, $notifications, $lang_admin_resolve,
	$lang_admin_kc, $kc, $lang_admin_ReadTheAgreement,
	
	
	$lang_admin_footer1,$lang_admin_footer1_1,$lang_admin_footer1_2,$lang_admin_footer1_3,
	$lang_admin_footer2,$lang_admin_footer2_1,$lang_admin_footer2_2,$lang_admin_footer2_3,$lang_admin_footer2_4,
	$lang_admin_footer3,$lang_admin_footer3_1,$lang_admin_footer3_2,
	$lang_admin_footerRights,
	 
	$lang_admin_home, $thisPageNav,
	
	$lang_admin_newEntries, $new_entries_list	
	
	);
	$static_name = array ("{blog_dir}","{blog_windows_encoding}", "{title_name}", "{JAVA_ALERTS}", "{blog_slogan}", "{lang_admin_showHomePage}", "{lang_admin_link_1}", "{lang_admin_link_2}", "{lang_admin_link_3}", "{lang_admin_link_4}", "{lang_admin_link_5}", "{lang_admin_link_6}", "{lang_admin_link_7}", "{lang_admin_sync}", "{lang_admin_search}",
	
	"{lang_admin_quickLinks}","{quicklinks}","{lang_admin_readDocumentation}",
	"{lang_admin_notifications}", "{notifications}", "{lang_admin_resolve}",
	"{lang_admin_kc}", "{kc}", "{lang_admin_ReadTheAgreement}",
	
	
	"{lang_admin_footer1}","{lang_admin_footer1_1}","{lang_admin_footer1_2}","{lang_admin_footer1_3}",
	"{lang_admin_footer2}","{lang_admin_footer2_1}","{lang_admin_footer2_2}","{lang_admin_footer2_3}","{lang_admin_footer2_4}",
	"{lang_admin_footer3}","{lang_admin_footer3_1}","{lang_admin_footer3_2}",
	"{blog_rights}",
	 
	"{lang_admin_home}", "{thisPageNav}",

	"{lang_admin_newEntries}", "{new_entries_list}"			
	
	);	
	
	$header = $new_template->load_template ("../templates/$defaultTemplate/admin/header.html");
	$home = $new_template->load_template ("../templates/$defaultTemplate/admin/clear.html");
	$footer = $new_template->load_template ("../templates/$defaultTemplate/admin/footer.html");		
	$template = $new_template->replace_static($static_name, $static_value, $header.$home.$footer);	
	echo $template;
	
	mysql_query("TRUNCATE eblog_new");
	mysql_close($conn);

	
}
 
 else{   
    echo "<meta http-equiv=\"refresh\" content=\"0;url=index.php\">";
 }	

	
?>
Return current item: eBlog