Просмотр файла admin/del.php

Размер файла: 5.26Kb
<?php

/*********************************************************************
 *
 * WapSite powered by CsC Portal. WapSite[tm] is module of CsC Portal.
 *
 * (C) 2004. CsC Portal. All rights reserved.
 *
 * http://cscp.cs-centar.net | http://www.cs-centar.net
 *
 ********************************************************************/

// File: admin/del.php
// Desc: Use to delete page(s), news & file(s) from database
// Written on: 25.04.2004

include("../wap_db.php");
include("../db_connect.php");

if ($_GET['substr'] == "news" && $_GET['page'] == $page) {

include("ad_header.php");

echo "<br><br><center><form method=\"get\" action=\"del.php\"><input type=\"hidden\" name=\"substr\" value=\"news\"><input type=\"hidden\" name=\"page\" value=\"$page\">$lang_ques[news_del]<br><br><input type=\"submit\" value=\"YES\" name=\"value\"> &nbsp; <input type=\"submit\" value=\"NO\" name=\"value\"></form></center><br><br>";


	if ($_GET['substr'] == "news" && $_GET['page'] == $page && $_GET['value'] == "YES") {

		$news_del = mysql_query("DELETE from cscp_wap_news WHERE news_name = '$page'", $db);

		// checking if email func. is on

			$email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'news'", $db);

			$email_send_f = mysql_fetch_row($email_send);

			if ($email_send_f[5] == "yes") {

				include("temp/$SiteLang/mail_send.tmp");

				mail($AdminEmail, "$lang_sendm[news_delete]", $send_message_d[news]);

				echo "<br><center><b>$lang_sendm[info]</b></center>";

		}

		echo "<br><br><center><b>$lang_display_news[success_del]</b></center>";

		include("ad_footer.php");

	} elseif ($_GET['substr'] == "news" && $_GET['page'] == $page && $_GET['value'] == "NO") {

	echo "<br><center><b>$lang_delete[info_n]</b></center><br><br><center><b><< $lang_display[back_to] <a href=\"ad_menu.php?act=news\"><font color=\"ff0000\"><u>$lang_display_menu[news]</u></a></b></center>";

	include("ad_footer.php");

	}

}

// code for deleting page(s)

if ($_GET['substr'] == "edit_delete" && $_GET['page'] == $page) {

include("ad_header.php");

echo "<br><br><center><form method=\"get\" action=\"del.php\"><input type=\"hidden\" name=\"substr\" value=\"edit_delete\"><input type=\"hidden\" name=\"page\" value=\"$page\">$lang_ques[page_del]<br><br><input type=\"submit\" value=\"YES\" name=\"value\"> &nbsp; <input type=\"submit\" value=\"NO\" name=\"value\"></form></center><br><br>";


	if ($_GET['substr'] == "edit_delete" && $_GET['page'] == $page && $_GET['value'] == "YES") {

		$page_del = mysql_query("DELETE from cscp_wap_page WHERE page_name = '$page'", $db);

		$page_del_2 = mysql_query("DELETE from cscp_wap_menu WHERE menu_id = '$page'", $db);

		// checking if email func. is on

			$email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'page'", $db);

			$email_send_f = mysql_fetch_row($email_send);

			if ($email_send_f[5] == "yes") {

				include("temp/$SiteLang/mail_send.tmp");

				mail($AdminEmail, "$lang_sendm[page_delete]", $send_message_d[page]);

				echo "<br><center><b>$lang_sendm[info]</b></center>";

		}

		echo "<br><br><center><b>$lang_display_p[success_del]</b></center>";

		include("ad_footer.php");

	} elseif ($_GET['substr'] == "edit_delete" && $_GET['page'] == $page && $_GET['value'] == "NO") {

	echo "<br><center><b>$lang_delete[info_p]</b></center><br><br><center><b><< $lang_display[back_to] <a href=\"ad_menu.php?act=news\"><font color=\"ff0000\"><u>$lang_display_menu[edit_delete]</u></a></b></center>";

	include("ad_footer.php");

	}


}

// code for deleting files

if ($_GET['substr'] == "files" && $_GET['file'] == $file) {

include("ad_header.php");

echo "<br><br><center><form method=\"get\" action=\"del.php\"><input type=\"hidden\" name=\"substr\" value=\"files\"><input type=\"hidden\" name=\"file\" value=\"$file\">$lang_ques[file_del]<br><br><input type=\"submit\" value=\"YES\" name=\"value\"> &nbsp; <input type=\"submit\" value=\"NO\" name=\"value\"></form></center><br><br>";


	if ($_GET['substr'] == "files" && $_GET['file'] == $file && $_GET['value'] == "YES") {

		$file_del = mysql_query("DELETE from cscp_wap_files WHERE file_name = '$file'", $db);

		// deleting from directory

		$file_url = mysql_query("SELECT * from cscp_wap_options WHERE id = 'panel'", $db);

		$file_url_p = mysql_fetch_row($file_url);

		$FileUrl = $file_url_p[2];

		unlink("$FileUrl/$file");


		// checking if email func. is on

			$email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'file'", $db);

			$email_send_f = mysql_fetch_row($email_send);

			if ($email_send_f[5] == "yes") {

				include("temp/$SiteLang/mail_send.tmp");

				mail($AdminEmail, "$lang_sendm[file_delete]", $send_message_d[file]);

				echo "<br><center><b>$lang_sendm[info]</b></center>";

		}

		echo "<br><br><center><b>$lang_display_files[success_del]</b></center>";

		include("ad_footer.php");

	} elseif ($_GET['substr'] == "files" && $_GET['file'] == $file && $_GET['value'] == "NO") {

	echo "<br><center><b>$lang_delete[info_f]</b></center><br><br><center><b><< $lang_display[back_to] <a href=\"ad_menu.php?act=news\"><font color=\"ff0000\"><u>$lang_display_menu[files]</u></a></b></center>";

	include("ad_footer.php");

	}


}

?>