Файл: test.zfarm.mobi/mystyleuser/linkzadaniya.php
Строк: 104
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
Год 2013 Права предоставлены автору Шехову Виталию Александровичу
http://vk.com/online_user
*/
/////////////////////////
if(isset($_GET['idyes']) && num($_GET['idyes'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_zadaniya` WHERE `type` = 'yes' AND `id` = '".num($_GET['idyes'])."' AND `user` = '".$user['id']."' AND `time` <= '".$time."'LIMIT 1"),0)!=0){
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_zadaniya` WHERE `id` = '".num($_GET['idyes'])."' AND `time` <= '".$time."'"));
$farms = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_zadaniya_no` WHERE `id` = '".$farm['id_zadaniya']."'"));
$id_zad = 1;
$re1 = $user['money']+$farms['money'];
$re2 = $user['rating']+$farms['exp'];
$re3 = $user['int_zadaniya']+$id_zad;
mysql_query("UPDATE `mystyle_user` SET `int_zadaniya` = '".$re3."', `rating` = '".$re2."', `money` = '".$re1."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("DELETE FROM `mystyle_zadaniya` WHERE `id` = '".$farm['id']."' AND `user` = '".$user['id']."'");
header("Location: ./");
exit;
}
if(isset($_GET['id']) && num($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_zadaniya` WHERE `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."' AND `time` <= '".$time."'LIMIT 1"),0)!=0){
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_zadaniya` WHERE `id` = '".num($_GET['id'])."' AND `time` <= '".$time."'"));
$farms = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_zadaniya_no` WHERE `id` = '".$farm['id_zadaniya']."'"));
///////// Лог Пользователя ///// By MyStyle
$text = 'Выполняеться задание '.$farms['name'].'';
$time_zadanie = $farms['time']+time();
$type = 'yes';
mysql_query("UPDATE `mystyle_zadaniya` SET `time` = '".$time_zadanie."', `type` = '".$type."' WHERE `id` = '".$farm['id']."' AND `user` = '".$user['id']."'");
if($_SESSION['training'] == 'shahta1')
{
$_SESSION['training'] = 'zadan';
}
header("Location: ?linkuserzadaniya&ok");
exit;
}
if($int['int'] == $user['int_zadaniya']){
}else{
header("Location: ./");
exit;
}
echo '<img class="portrait" src="images/icons/tutorialFaceWithDialog.png" width="48" height="48" alt="o">
<div class="tframe">
<span class="small">'.$int['name'].'<br />'.$int['text'].'</span>
</div><br />';
if($int['zadaniya'])echo '<a class="btn"><b><img width="36" height="36" src="images/zadaniya/'.$int['col1'].'.png" alt="" /> '.$int['zadaniya'].' </b></a>';
if($int['zadaniya2'])echo '<a class="btn"><b><img width="36" height="36" src="images/zadaniya/'.$int['col2'].'.png" alt="" /> '.$int['zadaniya2'].' </b></a>';
if($int['zadaniya3'])echo '<a class="btn"><b><img width="36" height="36" src="images/zadaniya/'.$int['col3'].'.png" alt="" /> '.$int['zadaniya3'].' </b></a>';
echo '<div class="tframe">Награда: монет '.$int['money'].' и опыта '.$int['exp'].'.</div>';
if($int_user['type'] == 'no'){
echo '<br /><b class="btnp">'.$int['name'].', будет сделано! </b><a class="btnp" href="?linkuserzadaniya&id='.$int_user['id'].'">Выполнить</a><br /><br />';
}elseif($int_user['time'] < time()){
echo '<b class="btn">'.$int['name'].', '.$int['yes'].' </b><br /><a class="btnp" href="?linkuserzadaniya&idyes='.$int_user['id'].'">Забрать награду</a><br /><br />';
}else{
echo '<br/>Выполняеться задание: '.time_left($int_user['time']-$time).'
<div class="fr" style="padding: 5px 0 0 5px; width: 70%;">
<div>
<div>';
$bte = $int_user['time']-$time;
$times = $bte/$int['time']*100;
echo '<div class="expBorder">
<div class="expline2" style="width:'.$times.'%;"></div>
</div>
</div></div></div><br/><br/><br/>';
}
?>