Файл: Source/pages/getprize.php
Строк: 429
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once 'inc/header.php';
if (!isset($_SESSION['logged_in'])) {
header('Location: /login');
exit();
}
if (isset($_SESSION['user'], $_SESSION['pass'])) {
$user = str_replace(" ", "", $_SESSION['user']);
$user = sprintf("%s", mysql_real_escape_string($user));
} else {
$user = str_replace(" ", "", $_COOKIE['user']);
$user = sprintf("%s", mysql_real_escape_string($user));
}
$result = mysql_query("SELECT * FROM vn_users WHERE user='{$user}'") or die(mysql_error());
$row = mysql_fetch_array($result);
$mail = $row['email'];
$USERID = $row['id'];
$description = $row['about'];
$points = number_format($row['points'], 0, ',', ' ');
$query31 = mysql_query("SELECT count(id) as sms from `vn_sms` WHERE `userid` = '".$row['id']."'");
$row1 = mysql_fetch_array($query31);
$xaxa = $row1['sms'];
if ($row1['sms'] > 1) {
$sms = $xaxa;
} else {
$sms = $xaxa;
}
$regdate = date("j.F.Y", $row['regtime']);
if (empty($row['avatar'])) {
$avatar = "uploads/avatars/noavatar.png";
} else {
$avatar = $row['avatar'];
}
$result2 = mysql_query("SELECT forw FROM vn_messages WHERE forw='{$user}' and readed='0'") or die(mysql_error());
$countm = mysql_num_rows($result2);
if ($countm > 0) {
$countm = "<b>$countm</b>";
} else {
$countm = $countm;
}
?>
<body class="no-slider">
<!-- <body class="has-top-menu"> -->
<!-- BEGIN #slider-imgs -->
<div id="slider-imgs">
<div class="featured-img-box">
<div id="featured-img-1" class="featured-img"></div>
<div id="featured-img-2" class="featured-img invisible"></div>
<div id="featured-img-3" class="featured-img invisible"></div>
<div id="featured-img-4" class="featured-img invisible"></div>
</div>
<!-- END #slider-imgs -->
</div>
<!-- BEGIN #top-layer -->
<div id="top-layer">
<div id="header-top">
<?php
require_once 'inc/header_top.php';
?>
</div>
<section id="content">
<header id="header">
<div id="menu-bottom">
<?php
require_once 'inc/menu_bottom.php';
?>
</div>
<div class="wrapper">
<div class="header-breadcrumbs">
<?php require_once 'inc/stats.php';
?>
</div>
</div>
</header>
<br />
<br />
<div id="main-box" class="full-width">
<div id="main">
<!-- BEGIN .user-profile -->
<div class="user-profile">
<div class="profile-shadow"></div>
<!-- BEGIN .profile-left-side -->
<div class="profile-left-side">
<div class="the-profile-top">
<div class="profile-user-name">
<h1><?php echo $user;?></h1>
<div class="sttaa"><a href="/pm">Messages <b>(<?php echo $countm;?>)</b></a></div>
</div>
<div class="avatar online">
<div class="avatar-button"><a href="/avatar"><i class="fa fa-camera-retro"></i>Change avatar</a></div>
<img src="<?php echo $avatar;?>" class="setborder" style="width:100%;" alt="" />
</div>
<div class="user-panel-about">
<div>
<b><i class="fa fa-male"></i>Description</b>
<p>
<?php
if (empty($description)) {
$description = "None";
} else {
$description = htmlentities($description, ENT_COMPAT, 'UTF-8');
$description = $description;
$description = str_replace(":)", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace(":(", " <img border='0'src='assets/img/emoticons/02.gif'> ", "$description");
$description = str_replace(":D", " <img border='0'src='assets/img/emoticons/03.gif'> ", "$description");
$description = str_replace("8-)", " <img border='0'src='assets/img/emoticons/04.gif'> ", "$description");
$description = str_replace(":O", " <img border='0'src='assets/img/emoticons/05.gif'> ", "$description");
$description = str_replace(";)", " <img border='0'src='assets/img/emoticons/06.gif'> ", "$description");
$description = str_replace(";(", " <img border='0'src='assets/img/emoticons/07.gif'> ", "$description");
$description = str_replace("(sweat)", " <img border='0'src='assets/img/emoticons/08.gif'> ", "$description");
$description = str_replace(":|", " <img border='0'src='assets/img/emoticons/09.gif'> ", "$description");
$description = str_replace(":*", " <img border='0'src='assets/img/emoticons/10.gif'> ", "$description");
$description = str_replace(":p", " <img border='0'src='assets/img/emoticons/11.gif'> ", "$description");
$description = str_replace("(blush)", " <img border='0'src='assets/img/emoticons/12.gif'> ", "$description");
$description = str_replace(":^)", " <img border='0'src='assets/img/emoticons/13.gif'> ", "$description");
$description = str_replace(":-)", " <img border='0'src='assets/img/emoticons/14.gif'> ", "$description");
$description = str_replace(":-(", " <img border='0'src='assets/img/emoticons/15.gif'> ", "$description");
$description = str_replace("(love)", " <img border='0'src='assets/img/emoticons/16.gif'> ", "$description");
$description = str_replace("(inlove)", " <img border='0'src='assets/img/emoticons/16.gif'> ", "$description");
$description = str_replace(":_)", " <img border='0'src='assets/img/emoticons/17.gif'> ", "$description");
$description = str_replace("(talk)", " <img border='0'src='assets/img/emoticons/18.gif'> ", "$description");
$description = str_replace("(yawn)", " <img border='0'src='assets/img/emoticons/19.gif'> ", "$description");
$description = str_replace("(puke)", " <img border='0'src='assets/img/emoticons/20.gif'> ", "$description");
$description = str_replace("(doh)", " <img border='0'src='assets/img/emoticons/21.gif'> ", "$description");
$description = str_replace(":@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace("@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace(";@", " <img border='0'src='assets/img/emoticons/22.gif'> ", "$description");
$description = str_replace("(wasntme)", " <img border='0'src='assets/img/emoticons/23.gif'> ", "$description");
$description = str_replace("(party)", " <img border='0'src='assets/img/emoticons/24.gif'> ", "$description");
$description = str_replace(":s", " <img border='0'src='assets/img/emoticons/25.gif'> ", "$description");
$description = str_replace("(mm)", " <img border='0'src='assets/img/emoticons/26.gif'> ", "$description");
$description = str_replace("8-|", " <img border='0'src='assets/img/emoticons/27.gif'> ", "$description");
$description = str_replace(":x", " <img border='0'src='assets/img/emoticons/28.gif'> ", "$description");
$description = str_replace("(wave)", " <img border='0'src='assets/img/emoticons/29.gif'> ", "$description");
$description = str_replace("(hi)", " <img border='0'src='assets/img/emoticons/29.gif'> ", "$description");
$description = str_replace("(devil)", " <img border='0'src='assets/img/emoticons/31.gif'> ", "$description");
$description = str_replace("(hug)", " <img border='0'src='assets/img/emoticons/35.gif'> ", "$description");
$description = str_replace("(thing)", " <img border='0'src='assets/img/emoticons/39.gif'> ", "$description");
$description = str_replace("(rofl)", " <img border='0'src='assets/img/emoticons/41.gif'> ", "$description");
$description = str_replace("(whew)", " <img border='0'src='assets/img/emoticons/42.gif'> ", "$description");
$description = str_replace("(happy)", " <img border='0'src='assets/img/emoticons/43.gif'> ", "$description");
$description = str_replace("(punch)", " <img border='0'src='assets/img/emoticons/47.gif'> ", "$description");
$description = str_replace("(skype)", " <img border='0'src='assets/img/emoticons/52.gif'> ", "$description");
$description = str_replace("(h)", " <img border='0'src='assets/img/emoticons/53.gif'> ", "$description");
$description = str_replace("(u)", " <img border='0'src='assets/img/emoticons/54.gif'> ", "$description");
$description = str_replace("(rain)", " <img border='0'src='assets/img/emoticons/57.gif'> ", "$description");
$description = str_replace("(sun)", " <img border='0'src='assets/img/emoticons/58.gif'> ", "$description");
$description = str_replace("(o)", " <img border='0'src='assets/img/emoticons/59.gif'> ", "$description");
$description = str_replace("(mp)", " <img border='0'src='assets/img/emoticons/62.gif'> ", "$description");
$description = str_replace("(pi)", " <img border='0'src='assets/img/emoticons/64.gif'> ", "$description");
$description = str_replace("(^)", " <img border='0'src='assets/img/emoticons/67.gif'> ", "$description");
$description = str_replace("(beer)", " <img border='0'src='assets/img/emoticons/68.gif'> ", "$description");
$description = str_replace("(d)", " <img border='0'src='assets/img/emoticons/69.gif'> ", "$description");
$description = str_replace("(drunk)", " <img border='0'src='assets/img/emoticons/75.gif'> ", "$description");
$description = str_replace("(flag:bg)", " <img border='0'src='assets/img/emoticons/77.gif'> ", "$description");
$description = str_replace("(bg)", " <img border='0'src='assets/img/emoticons/77.gif'> ", "$description");
$description = str_replace("(headbang)", " <img border='0'src='assets/img/emoticons/79.gif'> ", "$description");
$description = str_replace("(mooning)", " <img border='0'src='assets/img/emoticons/80.gif'> ", "$description");
$description = str_replace("(poolparty)", " <img border='0'src='assets/img/emoticons/81.gif'> ", "$description");
$description = str_replace("(smoke)", " <img border='0'src='assets/img/emoticons/83.gif'> ", "$description");
$description = str_replace("<plaintext></plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("</plaintext>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("alert", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<table>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<div>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<fieldset>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<script>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
$description = str_replace("<body>", " <img border='0'src='assets/img/emoticons/01.gif'> ", "$description");
}
echo $description;
?>
</p>
</div>
<style>
.maibaton{
font-family: "Cuprum",sans-serif;
text-transform: uppercase;
font-size: 13px;
font-weight: bold;
width:100%;padding:9px;color:#4D4D4D;border:0px;backround:#EAEAEA;
}
</style>
</div>
<div>
<ul class="user-button-list">
<li><a href="/cp" class="defbutton profile-button"><i class="fa fa-user"></i>Profile</a></li>
<li><a href="/messages" class="defbutton profile-button"><i class="fa fa-comment"></i>Mesagess</a></li>
<li><a href="/getprize" class="defbutton profile-button"><i class="fa fa-gift"></i>Get Prize</a></li>
<li><a href="/smspoints" class="defbutton profile-button"><i class="fa fa-mobile"></i>SMS Points</a></li>
<li><a href="/settings" class="defbutton profile-button"><i class="fa fa-cog"></i>Settings</a></li>
<li><a href="/logout" class="defbutton profile-button"><i class="fa fa-toggle-on"></i>Logout</a></li>
</ul>
</div>
</div>
<!-- END .profile-left-side -->
</div>
<!-- BEGIN .profile-right-side -->
<div class="profile-right-side">
<!-- BEGIN .content-padding -->
<div class="content-padding">
<div>
<div>
<h2 style="margin-left:-30px;"><span>Get Prize</span></h2>
<?php
$checkalln = mysql_query("SELECT * FROM vn_awarded WHERE userid='{$USERID}'");
$broi = mysql_num_rows($checkalln);
$pp = 5;
if ($broi > 0) {
$pages = ceil($broi / $pp);
$page = (int) $_GET['p'];
$page = sprintf("%s", mysql_real_escape_string($page));
if ($page == 0 || $page < 0 || $page == NULL) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$begin = ( $page * $pp ) - $pp;
echo "
<table class='blue'>
<thead>
<tr>
<th><center>#</td>
<th><center>Get Prize</th>
<th><center>Date</th>
<th><center>Status</th>
</tr>
</thead>";
$result = mysql_query("SELECT * FROM vn_awarded WHERE userid='{$USERID}' LIMIT {$begin},{$pp}");
for($i=0;$i < mysql_num_rows($result);++$i) {
$row = mysql_fetch_array($result);
$rank = $i+1+$begin;
$date = date("j F Y", $row['date']);
$result2 = mysql_query("SELECT user,vip FROM vn_users WHERE id='{$row[userid]}'") or die (mysql_error());
$row2 = mysql_fetch_array($result2);
$result3 = mysql_query("SELECT * FROM vn_prizes WHERE id='{$row[prizeid]}'") or die (mysql_error());
$row3 = mysql_fetch_array($result3);
$title = str_replace(" ", "-", $row3['title']);
$title = str_replace(":", "-", $title);
$title = str_replace("'", "", $title);
$title = str_replace("+", "|", $title);
$title = strtolower($title);
if($row['status'] == 0) {
$status = "<img src='assets/img/winners/processing.png' alt='Processing' title='Processing' width='16' height='16' /><br /> Processing";
} elseif($row['status'] == 1) {
$status = "<img src='assets/img/winners/check.png' alt='Check' title='Check' width='16' height='16' /><br /> Check";
} elseif($row['status'] == 2) {
$status = "<img src='assets/img/winners/canceled.png' alt='Canceled' title='Canceled' width='16' height='16' /><br /> Canceled";
} elseif($row['status'] == 3) {
$status = "<img src='assets/img/winners/fsend.png' alt='Processing dispatch' title='Processing dispatch' width='16' height='16' /><br /> Processing dispatch";
} elseif($row['status'] == 4) {
$status = "<img src='assets/img/winners/sent.png' alt='Sent' title='Sent' width='16' height='16' /><br /> Sent";
} elseif($row['status'] == 5) {
$status = "<img src='assets/img/winners/received.png' alt='Received' title='Received' width='16' height='16' /><br /> Received";
}
echo "
<tr>
<td style='text-align:center;'><font style='font-size: 20px;text-align:center;'>$rank</font></td>
<td><center><a href='/prize-$row3[id]' style='color:#545454;'> $row3[title] </a></center></td>
<td style='text-align:center;'>$date</td>
<td><center>$status</center>
$poluchih
</td>
</tr>
";
}
$next = $page + 1;
$next2 = $page + 2;
$prev = $page - 1;
$prev2 = $page - 2;
if ($pages >= $next) {
$nexts = "<a class='page' onClick="jump('/getprize-$next$wheref');">></a>";
$pageup1 = "<a class='page' onClick="jump('/getprize-$next$wheref');">$next</a>";
} else {
$nexts = "<a class='page' class='npage' disabled='disabled'>></button>";
}
if ($pages >= $next2) {
$pageup2 = "<a class='page' class='page' onClick="jump('/getprize-$next2$wheref');">$next2</a>";
$last = "<a class='page' class='page' onClick="jump('/getprize-$pages$wheref');">>></a>";
} elseif ($pages >= $next) {
$last = "<a class='page' class='page' onClick="jump('/getprize-$pages$wheref');">>></a>";
} else {
$last = "<a class='page' class='npage' disabled='disabled'>>></a></li>";
}
if ($page > 2) {
$pagedw2 = "<a class='page' class='page' onClick="jump('/getprize-$prev2$wheref');">$prev2</a>";
$first = "<a class='page' class='page' onClick="jump('/getprize-1$wheref');"><<</a>";
} else {
$first = "<a class='page' class='npage' disabled='disabled'><<</a>";
}
if ($page > 1) {
$prevs = "<a class='page' class='page' onClick="jump('/getprize-$prev$wheref');"><</a>";
$pagedw1 = "<a class='page' class='page' onClick="jump('/getprize-$prev$wheref');">$prev</a>";
$first = "<a class='page' class='page' onClick="jump('/getprize-1$wheref');"><<</a>";
} else {
$prevs = "<a class='page' class='npage' disabled='disabled'><</a>";
}
if ($page == 1 and $pages > 3) {
$pageup3 = "<a class='page' class='page' onClick="jump('/getprize-4$wheref');">4</a>";
}
if ($page == 1 and $pages > 4 or $page == 2 and $pages > 4) {
$pageup4 = "<a class='page' class='page' onClick="jump('/getprize-5$wheref');">5</a>";
}
if ($page == $pages and $pages < 5) {
$pagedw3 = "<a class='page' class='page' onClick="jump('/getprize-1$wheref');">1</a>";
}
echo "</table>";
if ($broi > $pp) {
echo "
<div>
<br />
$first $prevs $pagedw3 $pagedw2 $pagedw1 <a class='npage' disabled='disabled'>$page</a> $pageup1 $pageup2 $pageup3 $pageup4 $nexts $last
</div>";
}
} else {
echo "
<div class='info-message' style='background-color: #a24026;'>
You have not yet won awards.</div>";
}
?>
<div>
</div>
<!-- END .content-padding -->
</div>
<!-- END .profile-right-side -->
</div>
<div class="clear-float"></div>
<!-- END .user-profile -->
</div>
</div>
<div class="clear-float"></div>
</div>
</div>
</div>
<?php
require_once 'inc/footer.php';
?>