Файл: Source/pages/prizes.php
Строк: 146
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once 'inc/header.php';
?>
<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'; ?>
<ul>
<li><a href="index.php">Home</a></li>
<li>Prizes </li>
</ul>
</div>
</div>
</header>
<div id="main-box" class="full-width">
<div id="main">
<div class="signup-panel">
<div class="content-padding">
<style>
.nagrada{
width:100%;
border:1px solid #000;
border-radius:4px;
}.nagrada-ime{
background:url(assets/images/header-top-bg.png);
color:#fff;
padding:10px;
border-bottom:2px solid #fff;
border-radius:3px;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
}
.nagrada-snimka {
height:180px;
}
.nagrada-snimka img{
width:100%;
height:100%;
}.nagrada-baton{
width:100%;
color:#fff;
}.nagrada-baton .button{
width:91%;
text-align:center;
padding:4%;
margin:0;
font-size:15px;
}
</style>
<div style="text-align:center;">
<?php
$checkalln = mysql_query("SELECT `id` FROM `vn_prizes`");
$broi = mysql_num_rows($checkalln);
$pp = 36;
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;
$result = mysql_query("SELECT * FROM vn_prizes ORDER by points ASC LIMIT {$begin},{$pp}") or die(mysql_error());
for($i=0;$i < mysql_num_rows($result);++$i) {
$row = mysql_fetch_assoc($result);
$rank = $i+1+$begin;
$points = number_format($row['points'], 0, ',', ' ');
if ($row['quantity'] <= 0) {
$button = "<div class='btn btn-info' style='width:100%'>$points T</div>";
} else {
$button = "<div class='btn btn-info' style='width:100%' >$points T";
}
$style = "margin-left:0px;padding-left:0px;";
echo "
<div style='width:23.40%;float:left;margin-right:15px;margin-top:15px;' $style>
<div class='nagrada'>
<div class='nagrada-ime'>
$row[title]
</div>
<div class='nagrada-snimka'>
<a href='/prize-$row[id]'>
<img src='$row[image]' />
</a>
</div>
<div class='nagrada-baton'>
<a href='/prize-$row[id]' class='button'>$points points</a>
</div>
</div>
</div>";
}
$next = $page + 1;
$next2 = $page + 2;
$prev = $page - 1;
$prev2 = $page - 2;
if ($pages >= $next) {
$nexts = "<a href='/prizes-$next'><button class='page'>></button></a>";
$pageup1 = "<a href='/prizes-$next'><button class='page'>$next</button></a>";
} else {
$nexts = "<button class='npage' disabled='disabled'>></button>";
}
if ($pages >= $next2) {
$pageup2 = "<a href='/prizes-$next2'><button class='page'>$next2</button></a>";
$last = "<a href='/prizes-$pages'><button class='page'>>></button></a>";
} else {
$last = "<button class='npage' disabled='disabled'>>></button>";
}
if ($page > 1) {
$prevs = "<a href='/prizes-$prev'><button class='page'><</button></a>";
$pagedw1 = "<a href='/prizes-$prev'><button class='page'>$prev</button></a>";
} else {
$prevs = "<button class='npage' disabled='disabled'><</button>";
}
if ($page > 2) {
$pagedw2 = "<a href='/prizes-$prev2'><button class='page'>$prev2</button></a>";
$first = "<a href='/prizes-1'><button class='page'><<</button></a>";
} else {
$first = "<button class='npage' disabled='disabled'><<</button>";
}
if ($page == 1 and $pages > 3) {
$pageup3 = "<a href='/prizes-4'><button class='page'>4</button></a>";
}
if ($page == $pages and $pages > 3) {
$pagedw3 = "<a href='/prizes-1'><button class='page'>1</button></a>";
}
if ($broi > $pp) {
echo "
<div style='clear:both'></div>
<div style='width:100%;text-align:left; margin:37px 20px 3px 10px; float:left;'>
$first $prevs $pagedw3 $pagedw2 $pagedw1 <button class='npage' disabled='disabled'>$page</button>
$pageup1 $pageup2 $pageup3 $nexts $last
</div>";
}
}
else {
echo "<div class='info-message'>There are no prizes.</div>";
}
?>
</div>
</div>
<div class="clear-float"></div>
</div>
</div>
<div class="clear-float"></div>
</div>
</div>
</div>
<?php
require_once 'inc/footer.php';
?>