Location: PHPKode > projects > Php Site Manager > delete_page.php
<?php
/***************************************************************************
 *                                delete_page.php
 *                            -----------------------
 *   begin                : Saturday, Feb 3, 2007 
 *   copyright            : (C) 1981-2007 Namaless
 *   email                : hide@address.com
 *
 *   $Id: delete_page.php 92 2007-05-01 10:57:00Z namaless $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program 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 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

####################################################################
########################## HEADER SECTION ##########################
####################################################################
//-------------
// INIT SYSTEM
//-------------
include ($server_root . 'common.php');
$lang->load_block('delete_page');


//-------------------------
// PERFORM CHECK IF LOGGED
//-------------------------
if (!$_SESSION['auth']['logged'])
{
	unset($_SESSION['auth']);
	
	$js->alert($l['common']['NOT_HAVE_ACCESS']);
	$js->go_url('http://' . $server_url . '/', TRUE);
}


//--------------
// PRINT HEADER
//--------------
include ($server_root . 'includes/page_header.php');


//------------------
// DEFINE PAGE VARS
//------------------
$page		= 'delete_page_body.tpl';
$page_name	= $l['delete_page']['PAGE_NAME'];


####################################################################
########################### HOME SECTION ###########################
####################################################################
//--------------
// REQUEST VARS
//--------------
$page_id	= $input->get_var($_GET, 'id', 0);
$submit		= $input->get_var($_POST, 'submit', FALSE);


//----------------------
// ASSIGN TEMPLATE VARS
//----------------------
$tpl->assign('page_id', $page_id);


//------------------
// PERFORM DELETION
//------------------
if ($submit)
{
	$tpl->assign('SUBMIT', TRUE);
	
	$page_id = $input->get_var($_POST, 'page_id', 0);
	
	
	//------------------------------------
	// NOT PERMISSION TO DELETE PAGE_ID 1
	//------------------------------------
	if ($page_id == 1)
	{
		$js->alert($l['delete_page']['NOT_DELETE_HOME_PAGE']);
		$js->go_url('http://' . $server_url . '/', TRUE);
	}
	
	$s_page = "DELETE FROM pages WHERE page_id = " . $page_id . "";
	$q_page = $db->query($s_page);
	
	$js->alert($l['delete_page']['DELETE_PAGE_COMPLETE']);
	$js->go_url('http://' . $server_url . '/', TRUE);
}
else
{
	$tpl->assign('SUBMIT', FALSE);
}


####################################################################
########################## FOOTER SECTION ##########################
####################################################################
//------------
// UNSET VARS
//------------
unset ($s_page, $q_page);


//--------------
// PRINT FOOTER
//--------------
include ($server_root . 'includes/page_tail.php');
?>
Return current item: Php Site Manager