Файл: inc/system/podarok.php
Строк: 266
<?php
$pod_money = mt_rand(1000,10000);
if($ku['level'] < 10){
$pod_rating = mt_rand(100,10000);
}
if($ku['level'] >= 10 and $ku['level'] < 20){
$pod_rating = mt_rand(10000,100000);
}
if($ku['level'] >= 20 and $ku['level'] < 30){
$pod_rating = mt_rand(100000,500000);
}
if($ku['level'] >= 30 and $ku['level'] < 40){
$pod_rating = mt_rand(500000,5000000);
}
if($ku['level'] >= 40 and $ku['level'] < 50){
$pod_rating = mt_rand(5000000,100000000);
}
if($ku['level'] >= 50 and $ku['level'] < 60){
$pod_rating = mt_rand(100000000,500000000);
}
if($ku['level'] >= 60 and $ku['level'] < 70){
$pod_rating = mt_rand(500000000,1000000000);
}
if($ku['level'] >= 70 and $ku['level'] <= 150){
$pod_rating = mt_rand(1000000000,10000000000);
}
$pod_ruby = mt_rand(3,10);
$req = mysql_query("SELECT * FROM `podarok` WHERE `id_user` = '".$ku['id']."'");
if(mysql_num_rows($req) == 0){
mysql_query("INSERT INTO `podarok` SET `id_user` = '".$ku['id']."'");
}
$pod = mysql_fetch_array($req);
if(isset($_GET['go_podarok'])){
if($pod['day'] == 0 and $pod['time'] != date('dm', time())){
mysql_query("UPDATE `kolhoz_user` SET `money` = `money` +".intval($_SESSION['pod_money'])." WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `podarok` SET `day` = 1, `time` = '".date('dm', time())."' WHERE `id_user` = '".$ku['id']."'");
$_SESSION['msg'] = 'Вы получили ежедневный подарок';
$_SESSION['pod_money']='';
header('Location: ?'); exit;
}
if($pod['day'] == 1 and $pod['time'] != date('dm', time())){
mysql_query("UPDATE `kolhoz_user` SET `rating` = `rating` +".intval($_SESSION['rating_pod'])." WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `podarok` SET `day` = 2, `time` = '".date('dm', time())."' WHERE `id_user` = '".$ku['id']."'");
$_SESSION['msg'] = 'Вы получили ежедневный подарок';
$_SESSION['rating'] = $_SESSION['rating_pod'];
$_SESSION['rating_pod']='';
header('Location: ?'); exit;
}
if($pod['day'] == 2 and $pod['time'] != date('dm', time())){
$req = mysql_query("SELECT * FROM `kolhoz_fishery_data` WHERE `type` = 'bait' and `name` = '".mysql_real_escape_string($_SESSION['bait'])."'");
$bait = mysql_fetch_array($req);
if(mysql_result(mysql_query('SELECT COUNT(`id`) FROM `kolhoz_fishery_user` WHERE `id_user` = "'.$ku['id'].'" AND `bait` = "'.$bait['id'].'"'), 0) < 1)
{
mysql_query("INSERT INTO `kolhoz_fishery_user` SET `id_user` = '".$ku['id']."', `bait` = '".$bait['id']."', `count` = 10");
}else{
mysql_query('UPDATE `kolhoz_fishery_user` SET `count` = `count` + "10" WHERE `id_user`="'.$ku['id'].'" AND `bait`="'.$bait['id'].'"');
}
mysql_query("UPDATE `podarok` SET `day` = 3, `time` = '".date('dm', time())."' WHERE `id_user` = '".$ku['id']."'");
$_SESSION['msg'] = 'Вы получили ежедневный подарок';
$_SESSION['bait'] = '';
header('Location: ?'); exit;
}
if($pod['day'] == 3 and $pod['time'] != date('dm', time())){
mysql_query("UPDATE `podarok` SET `time` = '".date('dm', time())."' WHERE `id_user` = '".$ku['id']."'");
header('Location: /garden?ok_podarok'); exit;
}
if($pod['day'] == 4 and $pod['time'] != date('dm', time())){
mysql_query("UPDATE `kolhoz_user` SET `rubies` = `rubies` +".intval($_SESSION['pod_ruby'])." WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `podarok` SET `day` = 0, `time` = '".date('dm', time())."' WHERE `id_user` = '".$ku['id']."'");
$_SESSION['msg'] = 'Вы получили ежедневный подарок';
$_SESSION['rubies'] = $_SESSION['pod_ruby'];
$_SESSION['pod_ruby']='';
header('Location: ?'); exit;
}
}
echo '<img src="http://'.$_SERVER['HTTP_HOST'].'/img/logo.gif">';
echo '<span id="id2" style="display:none"></span>
<div class="page-title bg-ed">Ежедневный бонус</div>
<div class="gift"></div>';
if(empty($_SESSION['pod_money'])){
$_SESSION['pod_money'] = $pod_money;
}
echo '<div class="flat-content-gift bg-ed gift '.($pod['day'] < 1 ? 'today' : null).'">
<table width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="30%" align="center">
<div class="daily-gift daily-gift-1"></div>
</td>
<td width="35%" align="center" vlign="middle">
'.($pod['day'] >= 1 ? '<span><div class="checked-daily-gift"></div><br/>' : ($pod['day'] < 1 ? '<a href="?go_podarok"><span class="font14 c-white">Забрать</span><br/>
<span class="font14 c-white"><span class="nobr"><img src="/img/icons/money.png">'.$_SESSION['pod_money'].'</span></span></a>' :
'<span class="font14 c-lightGray"><span class="nobr"></span><img src="/img/icons/money.png">'.$pod_money.'</span>')).'
</span>
</td>
<td align="center">
<span class="random-daily-gift-img" style="background-image: url('/img/podarok/advance.png');"></span>
</td>
</tr>
</tbody>
</table>
</div>';
if(empty($_SESSION['rating_pod'])){
$_SESSION['rating_pod'] = $pod_rating;
}
echo '<div class="flat-content-gift bg-ed gift '.($pod['day'] == 1 ? 'today' : null).'">
<table width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="30%" align="center">
<div class="daily-gift daily-gift-2"></div>
</td>
<td width="35%" align="center" vlign="middle">
'.($pod['day'] >= 2 ? '<span><div class="checked-daily-gift"></div><br/>' : ($pod['day'] == 1 ? '<a href="?go_podarok"><span class="font14 c-white">Забрать</span><br/>
<span class="font14 c-white"><span class="nobr"><span class="f-icon f-icon-diamond"></span><img src="/img/icons/experience.png">'.$_SESSION['rating_pod'].'</span></span></a>' :
'<span class="font14 c-lightGray"><span class="nobr"></span>Случайное количество опыта</span>')).'
</span>
</td>
<td align="center">
<span class="random-daily-gift-img" style="background-image: url('/img/podarok/exp.png')"></span>
</td>
</tr>
</tbody>
</table>
</div>';
if(empty($_SESSION['bait'])){
$req = mysql_query("SELECT * FROM `kolhoz_fishery_data` WHERE `type` = 'bait' ORDER BY RAND()");
$bait = mysql_fetch_array($req);
$_SESSION['bait'] = $bait['name'];
}
echo '<div class="flat-content-gift bg-ed gift '.($pod['day'] == 2 ? 'today' : null).'">
<table width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="30%" align="center">
<div class="daily-gift daily-gift-3"></div>
</td>
<td width="35%" align="center" vlign="middle">
'.($pod['day'] >= 3 ? '<span><div class="checked-daily-gift"></div><br/>' : ($pod['day'] == 2 ? '<a href="?go_podarok"><span class="font14 c-white">Забрать</span><br/>
<span class="font14 c-white"><span class="nobr"></span>'.htmlspecialchars($_SESSION['bait']).'</span></a>' :
'<span class="font14 c-lightGray"><span class="nobr"></span>Случайная наживка</span>')).'
</span>
</td>
<td align="center">
<span class="random-daily-gift-img" style="background-image: url('/img/podarok/common.png');"></span>
</td>
</tr>
</tbody>
</table>
</div>';
if(empty($_SESSION['fantik'])){
$fantik = mysql_fetch_array(mysql_query("SELECT * FROM `collections` ORDER BY RAND()"));
$_SESSION['fantik'] = $fantik['name'];
}
echo '<div class="flat-content-gift bg-ed gift '.($pod['day'] == 3 ? 'today' : null).'">
<table width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="30%" align="center">
<div class="daily-gift daily-gift-4"></div>
</td>
<td width="35%" align="center" vlign="middle">
'.($pod['day'] >= 4 ? '<span><div class="checked-daily-gift"></div><br/>' : ($pod['day'] == 3 ? '<a href="?go_podarok"><span class="font14 c-white">Забрать</span><br/>
<span class="font14 c-white"><span class="nobr"></span>'.htmlspecialchars($_SESSION['fantik']).'</span></a>' : '<span class="font14 c-lightGray"><span class="nobr"></span>Случайный фантик</span>')).'
</span>
</td>
<td align="center">
<span class="random-daily-gift-img" style="background-image: url('/img/podarok/collection2.png');"></span>
</td>
</tr>
</tbody>
</table>
</div>';
if(empty($_SESSION['pod_ruby'])){
$_SESSION['pod_ruby'] = $pod_ruby;
}
echo '<div class="flat-content-gift bg-ed gift '.($pod['day'] == 4 ? 'today' : null).'">
<table width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="30%" align="center">
<div class="super-big-daily-gift-img"></div>
</td>
<td width="45%" align="center" vlign="middle">
'.($pod['day'] == 4 ? '<a href="?go_podarok"><span class="font14 c-white" style="margin-right:20px;">Забрать</span><br/>
<span class="font14 c-white" style="margin-right:20px;"><span class="nobr" ><img src="/img/icons/ruby.png">'.$_SESSION['pod_ruby'].'</span></span></a>' :
'<span class="font14 c-lightGray" style="margin-right:13px;"><span class="nobr"></span>Случайное <br />количество рубинов</span>').'
</td>
<td width="30%" align="center">
<div class="super-big-daily-gift-img-diamant"></div>
</td>
</tr>
</tbody>
</table>
</div>';
echo "</div></div><div class='rzd2'>
</div>
<div class='foot-box'><div class='foot-box'>";
echo "Онлайн</span> <b>".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `date_last` > '".(time()-3600)."'"), 0)."</b>, регистраций
<b>".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user`"), 0)."</b><br>";
echo "Моя милая ферма</a> <br/>";
//$date = date("d $m");
//$today[1] = date("H:i:s");
//echo(" $date $today[1]");
echo'</div>';
echo "</div></div>";
exit;
?>