Location: PHPKode > projects > Sound PHP Engine > s-p-e-0.3.0/s-p-e-0.3.0/data/pnewest.php
<?php
// ===================================================== 
// 
// s-p-e - Content management system. 
// Copyright (C) 2004, 2005, 2010, 2011 Vladimir B. Tsarkov
// 
// This file is part of s-p-e. 
// 
// s-p-e is free software; you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by 
// the Free Software Foundation, either version 3 of the License, or 
// (at your option) any later version. 
// 
// s-p-e is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
// GNU General Public License for more details. 
// 
// You should have received a copy of the GNU General Public License 
// along with s-p-e. If not, see <http://www.gnu.org/licenses/>.
//
// ------
//
//  You can contact me via e-mail: lipetsk-gnu-lug at bk period ru
//
//  pnewest.php
//
//  Abstract: Manages newest publications (removal from the list).
//  
//  Revision History:
// 
//	1  2005-09-18  vbt
//	2  2010-06-24  vbt
//	3  2011-01-22  vbt
//
// =====================================================
header("Content-Type: text/html; charset=UTF-8");

include("configure/specfg.php"); 
include("../include/functions.php");

cache();

session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
session_start();

gc();

redirect(read(session_id()));

if(read(session_id()) == "administrator")
{

	language($cfg["deflangadmin"]);
	
	if(isset($_POST["id"]))
	{
		$id = base64_decode($_POST["id"]);
	}
	if(isset($_POST["num"]))
	{
		$num = base64_decode($_POST["num"]);
	}
	
	if(ctype_digit($id) && ctype_digit($num))
	{
		echo "<HTML>
		<HEAD>
		<TITLE>".(_("Newest publications management"))."</TITLE> 
		<link rel=\"stylesheet\" type=\"text/css\" href=\"../skin/".($cfg["skin"])."/style.css\">
		</HEAD>
		<BODY>
		<p>
		<font class='s-normal' id='w-normal'>
		".(_("Back to the"))." <a href='newest.php'>".(_("Newest publications management"))."</a>
		</font>
		</p>";
	
		connect($cfg["host"], $cfg["user"], $cfg["password"], $cfg["database"], $connector);
		$result = mysql_query("select pnid 
			from ".($cfg["prefix"])."partition 
			where num='$id'", $connector) 
			or die("error #102-1");
		while($row = mysql_fetch_array($result, MYSQL_NUM))
		{
			$pointer = $row[0];
		}
		mysql_free_result($result);
		$result = mysql_query("select num 
			from ".($cfg["prefix"].$pointer)." 
			where num='$num'", $connector) 
			or die("error #102-2");
		if(mysql_num_rows($result) != 0)
		{
			while($row = mysql_fetch_array($result, MYSQL_NUM))
			{
				$number = $row[0];
			}
			mysql_free_result($result);
			
			mysql_query("update ".($cfg["prefix"].$pointer)." 
				set state='1' 
				where num='$number'") 
				or die("error #102-3");
			
			echo "<p>
			<font class='positive'>
			".(_("The entry was successfully removed from the list of the newest publications."))."
			</font>
			</p>";
		}
		mysql_close($connector);
		echo "</BODY>
		</HTML>";
	}
} 
else 
{
	echo _("Access denied.");
}
?>
Return current item: Sound PHP Engine