Файл: otpusk.php
Строк: 249
<? include("header.php");
$urlpage='Отпуск';
require("inc/connect.inc.php");
if (isset($_COOKIE['id']) and isset($_COOKIE['hash']))
{
$query = mysql_query("SELECT *,INET_NTOA(login_ip) as login_ip FROM ".$db_pref."users WHERE id = '".intval($_COOKIE['id'])."' LIMIT 1");
$userdata = mysql_fetch_assoc($query);
if(($userdata['hash'] !== $_COOKIE['hash']) or ($userdata['id'] !== $_COOKIE['id'])
or (($userdata['login_ip'] !== $_SERVER['REMOTE_ADDR']) and ($userdata['login_ip'] !== "0.0.0.0")))
{
echo "<div align='center'><font color='red'><br><b>".$lang['error16']."</b></font><br><br></div>";
}
else
{
if($lang_admin==en){ include('language/admin_mail_en.php');}
if($lang_admin==ru){ include('language/admin_mail_ru.php');}
if($stat==0):
if ($roworder >0){
echo"<div align='center'><font color='green'><b>{$lang['account']}</b></font><br><br></div>";
}
else{
echo"<br><div align='center'><font color='red'><b>{$lang['account']}</b></font><br><br></div><br>";
}
?>
<table class="form" width="95%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td align="center" border="1"><i><h2><?=$lang['zakaz'];?></h2></i><br></td>
</tr>
<?
$sql1=mysql_query("select*from ".$db_pref."pays");
$row1=mysql_fetch_array($sql1);
$urovni=$row1['urovni'];
$sql=mysql_query("select*from ".$db_pref."neworders where name='$user'");
$yes=mysql_num_rows($sql);
if($yes==0):
if($stat<$urovni):
$sql=mysql_query("select*from ".$db_pref."sysvals");
$row=mysql_fetch_array($sql);
$currency=$row['currency'];
$sql1=mysql_query("select*from ".$db_pref."pays");
$row1=mysql_fetch_array($sql1);
$lang['zakaz1']=str_replace("{pay}",$row1['pay'],$lang['zakaz1']);
echo"<tr><td align='center' ><font color='red'>{$lang['zakaz1']} ";
if($sistem==webmoney){
echo"WM$currency </b>";
}
if($sistem==liqpay){
echo'USD </b>';
}
?>
<br>
<br>
<b><a class="button" href="order.php"><i>.:: <?=$lang['zakaz2'];?> ::.</i></a></b></td>
</tr>
<?
endif;
else:
$row=mysql_fetch_array($sql);
$lang['zakaz3']=str_replace("{ur}",$row['rang'],$lang['zakaz3']);
?>
<tr>
<td align="center" ><?=$lang['zakaz3'];?></td>
</tr>
<tr>
<td align="center" >
<?=$lang['zakaz4'];?>
</td>
</tr>
<tr>
<td align="center" ><b><a class="button" href="sendmail.php?from_email=<?=$email;?>&tema=<?=$lang['zakaz5'];?>">..:: <?=$lang['mail4'];?> ::..</a></b></td>
</tr>
<?
endif;
?>
</table>
<?
else:
$rest=($_POST["rest"]);
$auot=($_POST["auot"]);
$sql=mysql_query("select*from ".$db_pref."sysvals");
$row=mysql_fetch_array($sql);
$site_url=$row['site_url'];
$sql=mysql_query("select*from ".$db_pref."pays");
$row=mysql_fetch_array($sql);
$pay_otpusk=$row['pay_otpusk'];
$income_otpusk=$row['income_otpusk'];
if(isset($rest)):
$sql=mysql_query("select*from ".$db_pref."rest where login='$user'");
$row=mysql_fetch_array($sql);
$id_no=$row['login'];
if($id_no!=$user){
$date_returning=date("d.m.Y H:i", mktime(date("H"), date("i"), date("s"), date("m") , date("d") + 5, date("Y")));
$sql=mysql_query("select*from ".$db_pref."users where user='$user'");
$row=mysql_fetch_array($sql);
$rwm=$row['wm'];
$ralert=$row['alertpay'];
$rperfekt=$row['perfektmoney'];
$sqladm=mysql_query("select*from ".$db_pref."users where id='1'");
$rowadm=mysql_fetch_array($sqladm);
$admin_email=$rowadm['email'];
$admwm=$rowadm['wm'];
$admaler=$rowadm['alertpay'];
$admper=$rowadm['perfektmoney'];
$date_leaving=date("d.m.Y H:i");
$lang['otpusk1']=str_replace("{user}",$user,$lang['otpusk1']);
$otpusk1=$lang['otpusk1'];
$lang['otpusk_mail']=str_replace("{user}",$user,$lang['otpusk_mail']);
$lang['otpusk_mail']=str_replace("{date_leaving}",$date_leaving,$lang['otpusk_mail']);
$lang['otpusk_mail']=str_replace("{date_returning}",$date_returning,$lang['otpusk_mail']);
$lang['otpusk_mail']=str_replace("{site_url}",$site_url,$lang['otpusk_mail']);
$date_return=date( time() + 5 * 86400 );
$date_leav=time();
mysql_query("insert into ".$db_pref."rest values(null, '$user', '$rwm','$rperfekt','$ralert', '$date_leav', '$date_return')");
mysql_query("update ".$db_pref."users set wm='$admwm', perfektmoney='$admper', alertpay='$admaler' where user='$user'");
$opu=$lang['otpusk_mail'];
?><div align="center">
<font color="red"><?=$lang['otpusk10'];?></font><br><br></div>
<?
mail("$admin_email","$otpusk1!","$opu","From: $admin_emailn"."Content-type: text/plain; charset=utf-8");
}
endif;
?>
<?php if(isset($auot)):
$sql=mysql_query("select*from ".$db_pref."rest where login='$user'");
$row=mysql_fetch_array($sql);
$id_no=$row['login'];
if($id_no==$user){
$sql2=mysql_query("select*from ".$db_pref."rest where login='$user'");
$row2=mysql_fetch_array($sql2);
$verwm=$row2['wm'];
$verper=$row2['per'];
$veraler=$row2['aler'];
$date_returning= date('d.m.Y H:i', $row2['date_returning']);
$date=date("d.m.Y H:i");
mysql_query("update ".$db_pref."users set wm='$verwm',alertpay='$veraler',perfektmoney='$verper' where user='$user'");
mysql_query("delete from ".$db_pref."rest where login='$user'");
$lang['otpusk13']=str_replace("{user}",$user,$lang['otpusk13']);
$lang['otpusk_mail1']=str_replace("{user}",$user,$lang['otpusk_mail1']);
$lang['otpusk_mail1']=str_replace("{date}",$date,$lang['otpusk_mail1']);
$lang['otpusk_mail1']=str_replace("{date_returning}",$date_returning,$lang['otpusk_mail1']);
$lang['otpusk_mail1']=str_replace("{site_url}",$site_url,$lang['otpusk_mail1']);
$vizotp=$lang['otpusk_mail1'];
$otpusk13=$lang['otpusk13'];
?><div align="center">
<font color="red"><?=$lang['otpusk11'];?></font><br><br></div>
<?
mail("$admin_email","$otpusk13","$vizotp","From: $admin_emailn"."Content-type: text/plain; charset=utf-8");
}
endif;
?>
<?php
$sql3=mysql_query("select*from ".$db_pref."rest where login='$user'");
$row3=mysql_fetch_array($sql3);
$pr=$row3['login'];
$date_returning = date('d.m.Y H:i', $row3['date_returning']);
if ($pr==$user):
include("inc/usermenu.inc.php");
$lang['otpusk6']=str_replace("{user}",$user,$lang['otpusk6']);
$lang['otpusk9']=str_replace("{pay_otpusk}",$pay_otpusk,$lang['otpusk9']);
$lang['otpusk8']=str_replace("{date_returning}",$date_returning,$lang['otpusk8']);
?>
<br><div align="center">
<table class="form" width="95%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td align="center"><h2><i><?=$lang['otpusk7'];?></i></h2><br></td>
</tr>
<tr>
<td align="center" class="table">
<?=$lang['otpusk6'];?><br>
<?=$lang['otpusk8'];?><br>
<?=$lang['otpusk9'];?></td>
</tr>
<form method=post action="otpusk.php">
<tr>
<td align="center">
<input class="button" type="submit" name="auot" value=".:: <?=$lang['otpusk7'];?> ::.">
</td>
</tr>
</form>
</table></div>
<?
else:
include("inc/usermenu.inc.php");
$lang['otpusk3']=str_replace("{user}",$user,$lang['otpusk3']);
$lang['otpusk3']=str_replace("{pay_otpusk}",$pay_otpusk,$lang['otpusk3']);
?>
<br><div align="center">
<table class="form" width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><h2><i><?=$lang['otpusk4'];?></i></n2><br></td>
</tr>
<tr>
<td align="center" ><?=$lang['otpusk3'];?></td>
</tr>
<form method=post action="otpusk.php">
<tr>
<td align="center" ><input class="button" type="submit" name="rest" value=".:: <?=$lang['otpusk5'];?> ::."></td>
</tr>
</form>
</table></div>
<?
endif;
endif;
}
}
else
{
echo "<div align='center'><font color='red'><br><b>".$lang['error']."</b></font><br><br></div>";
}
include("footer.php");
?>