View file admin/add.php

File size: 4Kb
<?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/add.php
// Desc: Use to add news & new pages to the database
// Written on: 24.04.2004

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

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

include("ad_header.php");

$news_check = mysql_query("SELECT * from cscp_wap_news WHERE news_name LIKE '%".$news_name."%'", $db);

$news_check_f = mysql_fetch_row($news_check);

	if ($news_check_f[0] == $news_name) {

	echo "<br><center><b>$lang_error[news_same]</b></center>";

	include("ad_footer.php");

	exit;

	} else {

$news_text = str_replace("\n","<br>", $news_text);

$news_add = mysql_query("INSERT into cscp_wap_news VALUES('$news_name', '$news_text', '$news_date')", $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[3] == "yes") {

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

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

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

		}

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

include("ad_footer.php");

	}

}

// starting page add

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

include("ad_header.php");

$page_check = mysql_query("SELECT * from cscp_wap_page WHERE page_name LIKE '%".$page_name."%'", $db);

$page_check_f = mysql_fetch_row($page_check);

	if ($page_check_f[0] == $page_name) {

	echo "<br><center><b>$lang_error[page_same]</b></center>";

	include("ad_footer.php");

	exit;

	} else {

$page_text = str_replace("\n","<br>", $page_text);

$page_add = mysql_query("INSERT into cscp_wap_page VALUES('$page_name', '$page_subject', '$page_text')", $db);

$page_add_2 = mysql_query("INSERT into cscp_wap_menu VALUES('$page_subject', '$page_id')", $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[3] == "yes") {

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

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

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

		}

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

include("ad_footer.php");

	}

}

// starting file upload

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

include("ad_header.php");

$file_check = mysql_query("SELECT * from cscp_wap_files WHERE file_name LIKE '%".$userfile."%'", $db);

$file_check_f = mysql_fetch_row($file_check);

	if ($file_check_f[1] == $userfile) {

	echo "<br><center><b>$lang_error[file_same]</b></center>";

	include("ad_footer.php");

	exit;

	} else {

	$file_id_count = mysql_query("SELECT * from cscp_wap_files", $db);

	$file_id_count_f = mysql_num_rows($file_id_count);

	$count_id = rand(0,1000);

	include("ad_functions.php");

	upload_file();

	$file_size = number_format($userfile_size);

	$file_add = mysql_query("INSERT into cscp_wap_files VALUES('$count_id', '$userfile_name', '$file_size')", $db);

	// 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[6] == "yes") {

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

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

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

			}

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

	include("ad_footer.php");

		}

}

?>