HEX
Server: Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 mod_fcgid/2.3.9 PHP/5.4.16
System: Linux dvm.vladweb.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: region-gk.ru (1016)
PHP: 8.2.27
Disabled: NONE
Upload Files
File: //var/www/temp/autoprokat.vladweb.ru/dogovors_print.php
<?
	session_start();
	include("cfg/connect.inc.php");
	include("cfg/mysql.php");
	include("cfg/general.inc.php");
	include("cfg/lang.inc.php");  	//authorized login check echo    $_SESSION["login"];

	include("./checklogin.php");//echo    $_SESSION["login"];

	/*if (!isset($_SESSION["login"]) || !isset($_SESSION["password"])) //unauthorized
	{
		die("� �� ������ �������!!!");
	}*/

	//   init Smarty
	error_reporting(E_ERROR);
	require 'smarty/Smarty.class.php';
	$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());
	mysql_query ("set character_set_client='cp1251'"); 
mysql_query ("set character_set_results='cp1251'"); 
mysql_query ("set collation_connection='cp1251_general_ci'");
@mysql_query("/*!40101 SET NAMES 'cp1251' */");
	//set Smarty include files dir
	//  set Smarty include files dir
	$smarty->template_dir = $template_path."/admin";


 //  $sql		=	"SELECT d.*,a.*,u.*  FROM dogovora d, auto a, users u WHERE  d.d_a_id = a.a_id and d.d_u_id = u.u_id  AND d_id = ";

	//show Smarty output
	if(isset($_GET['print_dogovor']))
		{
		    $sql		=	"SELECT d.*,a.*,u.*,unix_timestamp(d_start) as sd, unix_timestamp(d_end) as ed FROM dogovora d, auto a, users u WHERE  d.d_a_id = a.a_id and d.d_u_id = u.u_id  AND d_id = ".(int)$_GET['print_dogovor'];

			$res=mysql_query($sql) or DIE ("SELECT * FROM users ERROR! ".MYSQL_ERROR());

   		 	$auto=array();
		    $rowa=mysql_fetch_array($res);
			$auto=$rowa;
		  $s1 = ($auto['ed']-$auto['sd']);
		  if ($s1 == 0) $s1=$s1+1;
		  $auto['sd'] = floor(($s1-1)/3600/24+1);
 //           print_r($auto);

//�������������
			if (empty($auto[u_td])) $auto[u_td] = '_____________';
			if (empty($auto[u_ts])) $auto[u_ts] = '_____________';
			if (empty($auto[u_fname])) $auto[u_fname] = '_____________________________________';
			if (empty($auto[u_passport])) $auto[u_passport] = '_________________';
			if (empty($auto[u_dvidachi])) $auto[u_dvidachi] = '________________________________________________';
			if (empty($auto[u_prava])) $auto[u_prava] = '______________________________________________________';
			if (empty($auto[u_propiska])) $auto[u_propiska] = '______________________________________________________________';
			if (empty($auto[d_start]))
			{
			  $auto[u_startd] = '_________';
			  $auto[u_startt] = '_________';
			} 
			
			if (empty($auto[d_end]))
			{
			  $auto[u_endd] = '_________';
			  $auto[u_endt] = '_________';
			} 
			
			
			$smarty->assign("auto", $auto);


			$smarty->display("print_dogovor.tpl");
		}

//==========================================================print doverka
	elseif(isset($_GET['print_doverka']))
		{
		   $sql		=	"SELECT d.*,a.*,u.*, unix_timestamp(d_end) as ed FROM dogovora d, auto a, users u WHERE  d.d_a_id = a.a_id and d.d_u_id = u.u_id  AND d_id = ".(int)$_GET['print_doverka'];

		 	$res=mysql_query($sql) or DIE ("SELECT * FROM xxx ERROR! ".MYSQL_ERROR());
   		 	$auto=array();
		    $rowa=mysql_fetch_array($res) ;
		    $auto=$rowa;
//            print_r($auto);


			$auto['ed'] = ($auto['ed'] + (2*24*3600));

//�������������
			if (empty($auto[a_owner])) 
			{
			  $auto[a_owner] = '_____________________________________';
			  $auto[a_ownershort] = '_________________';
			} else
			{
			  $st1 = strtok($auto[a_owner], ' ');
			  $st2 = strtok(' ');
 			  $st3 = strtok(' ');
			  $auto[a_ownershort] = ' '.$st1.' '.$st2[0].'. '.$st3[0].'.';
			  if ((empty($st2)) || (empty($st3))) $auto[a_ownershort] = $auto[a_owner];
		    }

			if (empty($auto[a_ownerinfo])) $auto[a_ownerinfo] = '_________________________________________________________';
			if (empty($auto[u_fname])) $auto[u_fname] = '_____________________________________';
			if (empty($auto[u_passport])) $auto[u_passport] = '_________________';
			if (empty($auto[u_dvidachi])) $auto[u_dvidachi] = '________________________________________________';
			if (empty($auto[u_prava])) $auto[u_prava] = '______________________________________________________';
			if (empty($auto[u_propiska])) $auto[u_propiska] = '________________________________________________________';
			if (empty($auto[d_start]))
			{
			  $auto[u_startd] = '_________';
			  $auto[u_startt] = '_________';
			} 
			
			if (empty($auto[d_end]))
			{
			  $auto[u_endd] = '_________';
			  $auto[u_endt] = '_________';
			} 
//auto
			if (empty($auto[a_firma])) $auto[a_firma] = '__________';
			if (empty($auto[a_marka])) $auto[a_marka] = '__________';
			if (empty($auto[a_color])) $auto[a_color] = '__________';
			if (empty($auto[a_number])) $auto[a_number] = '__________';
			if (empty($auto[a_kuzov])) $auto[a_kuzov] = '__________';
			if (empty($auto[a_engine])) $auto[a_engine] = '__________';
			if (empty($auto[a_registr])) $auto[a_registr] = '__________';
			if (empty($auto[a_dvidachi])) $auto[a_dvidachi] = '__________';

			$smarty->assign("auto", $auto);

//_____________________________			

			if ($auto[a_isooo] == 1)
			{ 
			  $smarty->display("print_doverkaooo.tpl");
			} else
			{ 
			  $smarty->display("print_doverka1.tpl");
			}
				
		}
	elseif(isset($_GET['print_act']))
		{
		   $sql		=	"SELECT d.*,a.*,u.*  FROM dogovora d, auto a, users u WHERE  d.d_a_id = a.a_id and d.d_u_id = u.u_id  AND d_id = ".(int)$_GET['print_act'];
		 	$res=mysql_query($sql) or DIE ("SELECT * FROM users ERROR! ".MYSQL_ERROR());
   		 	$auto=array();
			$rowa=mysql_fetch_array($res);
			 $auto=$rowa;
			//  print_r($auto);
//�������������
			if (empty($auto[u_fname])) $auto[u_fname] = '_____________________________________';
			if (empty($auto[u_passport])) $auto[u_passport] = '_________________';
			if (empty($auto[u_dvidachi])) $auto[u_dvidachi] = '________________________________________________';
			if (empty($auto[u_prava])) $auto[u_prava] = '______________________________________________________';
			if (empty($auto[u_propiska])) $auto[u_propiska] = '________________________________________________________';
			if (empty($auto[d_start]))
			{
			  $auto[u_startd] = '_________';
			  $auto[u_startt] = '_________';
			} 
			
			if (empty($auto[d_end]))
			{
			  $auto[u_endd] = '_________';
			  $auto[u_endt] = '_________';
			} 
//auto
			if (empty($auto[a_firma])) $auto[a_firma] = '__________';
			if (empty($auto[a_marka])) $auto[a_marka] = '__________';
			if (empty($auto[a_color])) $auto[a_color] = '__________';
			if (empty($auto[a_number])) $auto[a_number] = '__________';
			if (empty($auto[a_kuzov])) $auto[a_kuzov] = '__________';
			if (empty($auto[a_engine])) $auto[a_engine] = '__________';
			if (empty($auto[a_registr])) $auto[a_registr] = '__________';
			if (empty($auto[a_dvidachi])) $auto[a_dvidachi] = '__________';

			if ((!empty($auto['a_picname'])) && ($auto['a_picname']!='NULL'))
			{
			  $auto['a_picname'] = UPLOAD_AUTO_DIR.$auto['a_picname'];
			} else
			{
			  $auto['a_picname'] = './i/actdefault.png';
			}
			$smarty->assign("auto", $auto);
			$smarty->display("print_act.tpl");
		}
	else{die("Fuck pridurok!!!");}


?>