Файл: LinkUser/LinkZadaniya.php
Строк: 122
<?php
/**
* @author MyStyle
* @copyright 2013
*/
if(isset($_GET['LinkOkUser']) && num($_GET['LinkOkUser'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_zadaniya_user` WHERE `id` = '".num($_GET['LinkOkUser'])."' AND `user` = '".$user['id']."' AND `type` = 'yes' LIMIT 1"),0)!=0){
$v1 = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_zadaniya_user` WHERE `id` = '".num($_GET['LinkOkUser'])."' AND `user` = '".$user['id']."'"));
$type = 'no';
$col2q = 0;
mysql_query("UPDATE `mystyle_user` SET `money` = '".($user['money']+$v1['money'])."', `ruby` = '".($user['ruby']+$v1['ruby'])."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `mystyle_zadaniya_user` SET `type` = '".$type."', `col2` = '".$col2q."' WHERE `user` = '".$user['id']."' AND `id` = '".num($_GET['LinkOkUser'])."'LIMIT 1");
echo '<div class="body feedbackPanel textshadow">
Купоны +<span><span class="money nobr textshadow"><img width="16" height="16" src="/images/icons/coins.png" alt=""/>
<span>'.$v1['money'].'</span></span></span> Наличка +<span><span class="money nobr textshadow">
<img width="16" height="16" src="/images/icons/ruby.png" alt=""/> <span>'.$v1['ruby'].'</span></span></span>
</div>';
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_zadaniya_user` WHERE `user` = '".$user['id']."'"),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,15);
$page=page($k_page);
$start=15*$page-15;
$q=mysql_query("SELECT * FROM `mystyle_zadaniya_user` WHERE `user` = '".$user['id']."' ORDER BY `id` DESC LIMIT $start, 15");
echo '<ul>';
while($post=mysql_fetch_array($q))
{
echo '<li class="emptyPanel">
<span class="whiteBoldLink textshadow">
<div>
<img width="48" height="48" alt="task" style="float: left; margin-right: 2%;" src="images/tasks.png"/>
<span class="whiteBoldLink">'.$post['name'].'</span>
<span class="whiteBoldLink fr"><span>'.$post['col2'].'</span> из <span>'.$post['col'].'</span></span>
<div class="whiteLink">'.$post['who'].' '.$post['korm'].'</div>
<div style="clear: both;"></div><div class="pt6"><div>';
echo '<div class="expBorder">';
$vets = $post['col2']*100/$post['col'];
echo '<div class="expline" style="width:'.$vets.'%;"></div>
</div></div></div>';
if($post['type'] == 'no'){
echo '<span class="whiteLink">Награда: </span>
<span style="float: right; margin-right: 4px;"><span class="money nobr textshadow">
<img width="16" height="16" src="images/icons/coins.png" alt=""/> <span>'.$post['money'].'</span></span></span>
<span style="float: right; margin-right: 4px;"><span class="money nobr textshadow">
<img width="16" height="16" src="images/icons/ruby.png" alt=""/> <span>'.$post['ruby'].'</span></span></span>';
}
if($post['type'] == 'yes'){
echo '<span class="whiteLink"><a href="?LinkZadaniya&LinkOkUser='.$post['id'].'">Забрать награду</a> </span>
<span style="float: right; margin-right: 4px;"><span class="money nobr textshadow">
<img width="16" height="16" src="images/icons/coins.png" alt=""/> <span>'.$post['money'].'</span></span></span>
<span style="float: right; margin-right: 4px;"><span class="money nobr textshadow">
<img width="16" height="16" src="images/icons/ruby.png" alt=""/> <span>'.$post['ruby'].'</span></span></span>';
}
if($post['type'] == NULL){
echo '<span class="whiteLink">Выполнено</span>';
}
echo '<br/>
</div>
</span>
</li>';
}
echo '</ul>';
if ($k_page>1)str("?&",$k_page,$page);
?>