File: //home/bk/efi/eficenter.ru/old/admin_gb_editandanswere.php
<?
ini_set('register_globals',1);
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';
echo "--";
//connect to database
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
echo "--";
$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");
}
// echo "--";
$smarty->template_dir = $template_path."/admin";
$smarty_mail->template_dir = $template_path."/mail";
if(isset($_GET['GB_EDT']))
{ // echo "--";
$QA="SELECT * FROM gb WHERE gb_id={$_GET['GB_EDT']} " ;
$res=mysql_query($QA) or DIE ("SELECT * FROM gb ERROR! ".MYSQL_ERROR());
$rowa=mysql_fetch_array($res) ;
$smarty->assign("row", $rowa);
$smarty->display($template_path."admin/admin_basic_index.tpl");
} ;
if(isset($_POST['GB_EDT'])&&isset($_POST['save_mess'])&&$_POST['save_mess']="1")
{
$id=intval($_POST['GB_EDT']);
$txt=validate_search_string($_POST['txt']);
$name=validate_search_string($_POST['name']);
$mail=validate_search_string($_POST['mail']);
$answ=validate_search_string($_POST['answ']);
$Query="UPDATE gb SET gb_text='$txt',gb_name='$name', gb_mail='$mail', gb_other='$answ' WHERE gb_id={$id}";
mysql_query($Query) or DIE ("UPDATE * FROM gb 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;
};
?>