File: //var/www/bk/efi/eficenter.ru/old/admin_scheme_edit.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
//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($_GET['SCHEME_EDT']))
{
$QA="SELECT * FROM scheme WHERE id_sch={$_GET['SCHEME_EDT']} " ;
$res=mysql_query($QA) or DIE ("SELECT * FROM scheme ERROR! ".MYSQL_ERROR());
$rowa=array();
$rowa=mysql_fetch_array($res) ;
echo "-";
$smarty->assign("row", $rowa);
$smarty->display($template_path."admin/admin_scheme_edit.tpl");
} ;
if(isset($_POST['SCHEME_EDT'])&&isset($_POST['save_scheme'])&&$_POST['save_scheme']="1")
{ $Query="UPDATE scheme SET firma='".$_POST['company']."',model='".$_POST['model']."', engine='".$_POST['engine']."', basket='".$_POST['basket']."', year='".$_POST['year']."',num_page='".$_POST['num_page']."', price='".$_POST['price']."' WHERE id_sch='".$_POST['SCHEME_EDT']."'";
mysql_query($Query) or DIE ("UPDATE * FROM scheme 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;
};
?>