Файл: public_html/gifts_action.php
Строк: 588
<?
$title = 'Подарки';
include './system/common.php';
include './system/functions.php';
include './system/user.php';
include './system/h.php';
function page($k_page=1){ // Выдает текущую страницу
$page=1;
if (isset($_GET['page'])){
if ($_GET['page']=='end')$page=intval($k_page);elseif(is_numeric($_GET['page'])) $page=intval($_GET['page']);}
if ($page<1)$page=1;
if ($page>$k_page)$page=$k_page;
return $page;}
function k_page($k_post=0,$k_p_str=10){ // Высчитывает количество страниц
if ($k_post!=0){$v_pages=ceil($k_post/$k_p_str);return $v_pages;}
else return 1;}
function str($link='?',$k_page=1,$page=1){ // Вывод номеров страниц (только на первый взгляд кажется сложно ;))
if ($page<1)$page=1;
echo'<div class="content"></div><center>';
if ($page!=1)echo "<a class='pg' href="".$link."page=1"><<</a> ";else echo "<span class='bnt1 pg'>1</span> ";
for ($ot=-2; $ot<=2; $ot++){
if ($page+$ot>1 && $page+$ot<$k_page){
if ($ot==-3 && $page+$ot>2)echo "";
if ($ot!=0)echo "<a class='pg' href="".$link."page=".($page+$ot)."">".($page+$ot)."</a> ";else echo " <span class='bnt1 pg'> ".($page+$ot)."</span> ";
if ($ot==2 && $page+$ot<$k_page-1)echo "";}}
if ($page!=$k_page)echo "<a class='pg' href="".$link."page=end"> >></a>";else echo "<span class='bnt1 pg'>".$page."</span> ";
echo "</center>n";
}
//Soars like an eagle
//There's no tomorrow
//For fear or sorrow © 404No7Found-_-
if(!$user['id']) {header('Location: /');exit();}
if($user['save']=='0') {header('Location: /save');exit();}
$action = (isset($_GET['action'])) ? htmlspecialchars($_GET['action']) : null;
switch($action){
default:
?>
<style>
.grid_li{display:inline-block;width:20%;margin-bottom:8px;vertical-align:top;text-align:center;border:0;}
@media (min-width: 880px){.grid_li{width:14.28%;}}
.grid_li{padding:16px 8px 8px;margin:0;-webkit-background-clip:content-box;background-clip:content-box;-webkit-box-sizing:content-box;box-sizing:border-box;}
@media (min-width: 810px){.grid_li{width:25%;}}
.gift-card{max-width:128px;}
.gift{padding-bottom:100%;width:100%;max-width:128px;height:0;-webkit-background-size:auto 100%;background-size:auto 100%;}
.gift-price{margin:4px 0 0;position:relative;white-space:nowrap;}
.gift-price_icon, .gift-price_text{position:relative;display:inline-block;}
.gift-price_text{padding:2px 8px 0;border:2px solid #fff;border-radius:12px;font-size:11px;line-height:18px;background-color:#34373a;color:#fff;}
.gift-price_icon, .gift-price_text{position:relative;display:inline-block;}
.gift, .gift-card, .gift-link{display:block;}
.gift-link{position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;}
.gift-price_icon{z-index:1;width:20px;height:20px;-webkit-box-shadow:0 0 0 2px #fff;box-shadow:0 0 0 2px #fff;border-radius:50%;background-color:#0091ed;-webkit-background-size:20px 20px;background-size:20px 20px;background-position:50% 50%;vertical-align:middle}
.gift-price_icon{background-image:url(https://m.ok.ru/mres/img/gifts/gift-price-icons/vip.png);background-color:#34373a;}
.gift-price_icon+.gift-price_text{margin-left:-8px;padding-left:24px;}
</style>
</div><div class='line'></div><div style='margin-bottom:1px;'></div></div>
<div class="main">
<?
$get_id = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = ".$_GET[us].""));
if(!$get_id) { header('location:/'); }else{ echo "<center>Подарок для {$get_id[login]}</center>"; }
?>
<div class="center">
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=100&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/100.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=101&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/101.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=102&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/102.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=118&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/118.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=125&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/125.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=65&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/65.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=70&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/70.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=16&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/16.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=62&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/62.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div></div></div><div style='margin-bottom:1px;'></div>
<div class="main">
<div class="block_zero"><span class="helvetica" style="font-size:20px;line-height:24px;font-weight:400;color:#ffe003;">Лучшие новинки</span></div><div class="line"></div>
<div class="center">
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=103&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/103.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=104&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/104.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=120&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/120.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=170&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/170.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=105&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/105.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=130&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/130.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=160&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/160.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=140&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/140.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=150&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/150.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=180&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/180.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=190&id=<?=$_GET[us]?>">
<div class="gift" style="background-image: url(/images/gifts/190.png); "></div>
<div class="gift-price"><span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
</div></div><div style='margin-bottom:1px;'></div>
<div class="main">
<div class="block_zero"><span class="helvetica" style="font-size:20px;line-height:24px;font-weight:400;color:#8B0000;">Романтика</span></div><div class="line"></div>
<div class="center">
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=26&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/26.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=22&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/22.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=31&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/31.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div style="margin-bottom:1px;"></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=64&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/64.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=54&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/54.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=72&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/72.png); "></div>
<div class="gift-price">
<span class="gift-price_text ">10 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
</div></div><div style='margin-bottom:1px;'></div>
<div class="main">
<div class="block_zero"><span class="helvetica" style="font-size:20px;line-height:24px;font-weight:400;color:#ffe003;">VIP-подарки</span></div><div class="line"></div>
<div class="center">
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=106&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/106.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=107&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/107.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=108&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/108.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div style="margin-bottom:7px;"></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=109&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/109.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=110&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/110.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
<div class="grid_li">
<div class="gift-card">
<a href="/gifts_action.php?action=send&gift=111&id=<?=$_GET[us]?>" style="text-decoration:none">
<div class="gift" style="background-image: url(/images/gifts/111.png); "></div>
<div class="gift-price">
<span class="gift-price_icon"></span>
<span class="gift-price_text ">15 <img src="/images/icon/gold.png"></span></div>
</a></div></div>
</div>
<?
break;
case 'send':
$gift = intval($_GET['gift']);
$id = _string(_num($_GET['id']));
if($gift == 103 or $gift == 104 or $gift == 105) $cena = 5;
if($gift == 26 or $gift == 22 or $gift == 31) $cena = 10;
if($gift == 64 or $gift == 54 or $gift == 72) $cena = 10;
if($gift == 106 or $gift == 40 or $gift == 16 or $gift == 62 or $gift == 107 or $gift == 108 or $gift == 109 or $gift == 110 or $gift == 111) $cena = 15;
if($id) {
$i = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$id.'"');
$i = mysql_fetch_array($i);
}else{ $i = $user;}
if (isset($_GET['go'])){
if(!$user){
$_SESSION['err'] = 'У вас не хватает <img src="/images/icon/gold.png"> '.(5 - $user['g']).' золота';
header('location: /mail/'.$_GET[gift].'');
exit();
}
if(!$user){
$_SESSION['err'] = 'У вас не хватает <img src="/images/icon/gold.png"> '.(15 - $user['g']).' золота';
header('location: /mail/'.$_GET[gift].'');
exit();
}
if ($user[id]==$i[id]){
$_SESSION['err'] = 'Самому себе дарить нельзя <img src="/images/smiles/1.png">';
header('location: /');
exit();
}
if(!$user){
$_SESSION['err'] = 'У вас закончились лимит бесплатных подарок';
header('location: /gifts_action.php');
exit();
}else{
$block_zero=$_POST['block_zero'];
$_SESSION['not'] = 'Подарок успешно отправлено';
if($user[g] >= 15) {
mysql_query("INSERT INTO `gifts` (`id_user`, `ot_id`, `text`, `time`, `id_gifts`, `anonim`, `bb`) values('$i[id]', '$user[id]', '".mysql_real_escape_string($block_zero)."', '".time()."', '$gift', '0', '0')");
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `contacts` WHERE `user` = ''.$user['id'].'' AND `ho` = ''.$i['id'].'''),0) == 0) {
mysql_query('INSERT INTO `contacts` (`user`,
`ho`,
`time`) VALUES (''.$user['id'].'',
''.$i['id'].'',
''.time().'')');
}else{
mysql_query('UPDATE `contacts` SET `time` = ''.time().'' WHERE `user` = ''.$user['id'].'' AND `ho` = ''.$i['id'].''');
mysql_query('UPDATE `contacts` SET `time` = ''.time().'' WHERE `ho` = ''.$user['id'].'' AND `user` = ''.$i['id'].''');
}
mysql_query('INSERT INTO `mail` (`from`,
`to`,
`text`,
`time`) VALUES (''.$user[id].'',
''.$i['id'].'',
'[center]Держи подарок от '.$user[login].'[br]<img src="/images/gifts/'.$_GET[gift].'.png" width=50%>[/center] ',
''.time().'')');
mysql_query("UPDATE `users` SET `g` = `g` - 15 WHERE `id` = ".$user[id]."");
}
header('location: /mail/'.$i[id].'');
exit();
}
}else{
echo'<div class="menuList"><li><a href="/gifts_action.php"><img src="/images/icon/arrow_b.png"> Назад к подаркам</a></li></div><div class="mini-line"></div>';
echo'<div class="block_zero center">';
echo''.$i['login'].'<div style="margin-bottom:10px;"></div>';
echo"<img src='/images/gifts/".$gift.".png' width=50%><br/>";
echo "<form method="post" action="gifts_action.php?action=send&id=$i[id]&gift=". htmlspecialchars($_GET['gift'])."&go&">";
echo "<div class='mb5'></div><div class='block_zero center'>Сообшение (не обязательно):<br/>";
echo "<textarea class='text large' name='block_zero' rows='4'></textarea><br/>";
echo'</div>';
echo'<div class="block_zero">';
echo "<span class='btn'><span class='end'><input class='label' type="submit" value="Отправить" />Отправить</span></span><br/>";
echo "</form></div>";
}
break;
case 'send_usr':
echo'
<div class="block_zero">
<span class="helvetica" style="font-size:20px;line-height:24px;font-weight:400;color:#ffe003;">Выберите игрока</span></div><div class="line"></div>';
$gift = intval($_GET['gift']);
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > "'.(time() - 600).'" AND `level` > "6" AND `login` != "'.$user['login'].'"'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;
}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
$q = mysql_query('SELECT * FROM `users` WHERE `online` > "'.(time() - 600).'" AND `level` > "6" AND `login` != "'.$user['login'].'" ORDER BY `level` DESC, `online` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
if($row['sex'] == 0) $sexs = 'Был';
if($row['sex'] == 1) $sexs = 'Была';
?>
<div class="block_zero">
<img src='/images/icon/race/<?=$row['r'].($row['online'] > (time() - 600) ? '':'-off')?>.png' alt='*'/> <a href='/gifts_action.php?action=send&gift=<?=$gift?>&id=<?=$row['id']?>'><?=$row['login']?></a> <img src='/images/icon/refresh.png' alt='*'/> <small><font color="lime">[<?=$sexs?> в сети: <?=vremja($row['online'])?>]</font></small><br/>
</div>
<?
}
if($count < 1){
echo '<div class="block"><center><b>На данный момент нет игроков в сети...</b></center></div>';
}
?>
?>
<div class="line"></div><div class="block_zero center">
<?=pages('?');?>
</div><div class="line"></div>
<div class="menuList"><li><a href="/gifts_action.php">Вернуться назад</a></li></div>
<?
}
echo "</center></center>";
include './system/f.php';
?>