File: //home/bk/efi/eficenter.ru/old/admin_news_editandanswere.php
<?
include("cfg/connect.inc.php");
include("cfg/mysql.php");
include("cfg/general.inc.php");
include("cfg/lang.inc.php");
include("cfg/functions.php");
require 'smarty/Smarty.class.php';
//connect to database
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
$smarty = new Smarty; //core smarty object
$smarty_mail = new Smarty; //for e-mails
//authorized login check
session_start();
include("./checklogin.php");
if (!isset($_SESSION["login"]) || strcmp($_SESSION["login"],ROOT_LOGIN)) //unauthorized
{
die ("You are not authorized to view this page");
}
$smarty->template_dir = $template_path."/admin";
$smarty_mail->template_dir = $template_path."/mail";
if(isset($N_EDT))
{
$QA="SELECT * FROM news WHERE n_id={$N_EDT} " ;
$res=mysql_query($QA) or DIE ("SELECT * FROM news ERROR! ".MYSQL_ERROR());
$rowa=mysql_fetch_array($res) ;
$smarty->assign("row", $rowa);
$smarty->display($template_path."admin/admin_news_basic_index.tpl");
} ;
if(isset($N_EDT)&&isset($save_mess_n)&&$save_mess_n="1")
{$title=validate_search_string($title);
$bigtext=validate_search_string($bigtext);
$smalltext=validate_search_string($smalltext);
$Query="UPDATE news SET n_title='$title', n_smalltext='$smalltext', n_bigtext='$bigtext' WHERE n_id='$N_EDT'";
mysql_query($Query) or DIE ("UPDATE * FROM news ERROR! ".MYSQL_ERROR());
//close window
echo "<script>\n";
echo "window.opener.location.reload();\n";
echo "window.close();\n";
echo "</script>\n</body>\n</html>";
exit;
};
?>