Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- body {
- margin: 0;
- background:#ddd;
- }
- h2 {
- margin:5px;
- }
- table {
- border-collapse:collapse;
- background:#333;
- color:#BBB;
- }
- th {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- color:#fe5;
- }
- #border {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- }
- #border td {
- border-left:1px solid #000;
- border-right:1px solid #000;
- }
- .pages {
- width:600px;
- text-align:center;
- }
- .paginate {
- font-family:Arial, Helvetica, sans-serif;
- padding: 3px;
- margin: 3px;
- }
- .paginate a {
- padding:2px 5px 2px 5px;
- margin:2px;
- border:1px solid #999;
- text-decoration:none;
- color: #666;
- }
- .paginate a:hover, .paginate a:active {
- border: 1px solid #999;
- color: #000;
- }
- .paginate span.current {
- margin: 2px;
- padding: 2px 5px 2px 5px;
- border: 1px solid #999;
- font-weight: bold;
- background-color: #999;
- color: #FFF;
- }
- .paginate span.disabled {
- padding:2px 5px 2px 5px;
- margin:2px;
- border:1px solid #eee;
- color:#BBB;
- }
- td a:link {
- color:#BBB;
- }
- td a:hover {
- color:#BBB;
- text-decoration:none;
- }
- td a:active {
- color:#BBB;
- }
- td a:visited {
- color:#BBB;
- }
- </style>
- <script type="text/javascript" src="http://static.wowhead.com/widgets/power.js"></script>
- <script type="text/javascript">
- var a = document.getElementsByTagName("a")
- for( i=0; i<a.length; i++ ){
- if( a[i].href.indexOf("http://" + document.domain + "/click.php?http://") != -1 )
- {a[i].href = "http://" + a[i].href.substring(a[i].href.lastIndexOf("http://")+7)}
- }
- </script>
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $cdb = 'characters';
- $wdb = 'world';
- $targetpage = "auction.php"; // Ссылка на эту страницу
- $limit = 10; // Сколько выводить результатов на страницу
- $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
- mysql_select_db ($cdb, $connect) or die(mysql_error());
- print "<h2 align=\"center\">Аукцион</h2>
- <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"900\"><tr>
- <th width=\"30\">№</th>
- <th width=\"120\">Продавец</th>
- <th>Итем</th>
- <th width=\"90\">Количество</th>
- <th width=\"120\">Ставка</th>
- <th width=\"120\">Выкуп</th>
- <th width=\"120\">Добавлено</th>
- </tr></table>";
- $query = "SELECT COUNT(*) as num FROM `auctionhouse`";
- $total_pages = mysql_fetch_array(mysql_query($query));
- $total_pages = $total_pages[num];
- $stages = 3;
- $page = mysql_escape_string(intval($_GET['page']));
- if($page){
- $start = ($page - 1) * $limit;
- }else{
- $start = 0;
- }
- $sql = mysql_query("SET NAMES cp1251");
- $sql = mysql_query("SELECT * FROM `auctionhouse` ORDER BY `time` DESC LIMIT $start, $limit", $connect) or die(mysql_error());
- if ($page == 0){$page = 1;}
- $prev = $page - 1;
- $next = $page + 1;
- $lastpage = ceil($total_pages/$limit);
- $LastPagem1 = $lastpage - 1;
- $paginate = '';
- if($lastpage > 1)
- {
- $paginate .= "<div class='paginate'>";
- if ($page > 1){
- $paginate.= "<a href='$targetpage?page=$prev'>Назад</a>";
- }else{
- $paginate.= "<span class='disabled'>Назад</span>"; }
- if ($lastpage < 7 + ($stages * 2))
- {
- for ($counter = 1; $counter <= $lastpage; $counter++)
- {
- if ($counter == $page){
- $paginate.= "<span class='current'>$counter</span>";
- }else{
- $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
- }
- }
- elseif($lastpage > 5 + ($stages * 2))
- {
- if($page < 1 + ($stages * 2))
- {
- for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
- {
- if ($counter == $page){
- $paginate.= "<span class='current'>$counter</span>";
- }else{
- $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
- }
- $paginate.= "...";
- $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
- $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
- }
- elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
- {
- $paginate.= "<a href='$targetpage?page=1'>1</a>";
- $paginate.= "<a href='$targetpage?page=2'>2</a>";
- $paginate.= "...";
- for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
- {
- if ($counter == $page){
- $paginate.= "<span class='current'>$counter</span>";
- }else{
- $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
- }
- $paginate.= "...";
- $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
- $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
- }
- else
- {
- $paginate.= "<a href='$targetpage?page=1'>1</a>";
- $paginate.= "<a href='$targetpage?page=2'>2</a>";
- $paginate.= "...";
- for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
- {
- if ($counter == $page){
- $paginate.= "<span class='current'>$counter</span>";
- }else{
- $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
- }
- }
- }
- if ($page < $counter - 1){
- $paginate.= "<a href='$targetpage?page=$next'>Далее</a>";
- }else{
- $paginate.= "<span class='disabled'>Далее</span>";
- }
- $paginate.= "</div>";
- }
- $id = 1;
- if ($_GET['page'] != 1)
- $id = $start + 1;
- while ($result = mysql_fetch_array($sql)){
- $guid = $result['itemowner'];
- $buyprice = $result['buyoutprice'];
- $item_guid = $result['itemguid'];
- $time = date("H:i:s d.m.Y", $result['time']);
- $gold = (int)($buyprice / 10000);
- $total = $buyprice - ($gold * 10000);
- $silver = (int)($total / 100);
- $cooper = $total - ($silver * 100);
- if ($result['lastbid'] == 0 || $result['lastbid'] == $result['startbid'])
- $bid = $result['startbid'];
- else
- $bid = $result['lastbid'];
- $gold_bid = (int)($bid / 10000);
- $total_bid = $bid - ($gold_bid* 10000);
- $silver_bid = (int)($total_bid / 100);
- $cooper_bid = $total_bid - ($silver_bid * 100);
- $sql_item = mysql_query("SELECT `itemEntry`, `count` FROM `item_instance` WHERE `guid` = $item_guid", $connect) or die(mysql_error());
- $result_item = mysql_fetch_array($sql_item);
- $item = $result_item['itemEntry'];
- $item_count = $result_item['count'];
- $sql_char = mysql_query("SET NAMES cp1251");
- $sql_char = mysql_query("SELECT `name` FROM `characters` WHERE `guid` = $guid", $connect) or die(mysql_error());
- $result_char = mysql_fetch_array($sql_char);
- $name = $result_char['name'];
- $sql_item_name = mysql_query("SET NAMES cp1251");
- mysql_select_db($wdb, $connect) or die(mysql_error());
- $sql_item_name = mysql_query("SELECT `name_loc8` FROM `locales_item` WHERE `entry` = $item", $connect) or die(mysql_error());
- $result_item_name = mysql_fetch_array($sql_item_name);
- $item_name = $result_item_name['name_loc8'];
- mysql_select_db($cdb, $connect) or die(mysql_error());
- print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"900\" id=\"border\"><tr>
- <td align=\"center\" width=\"30\">$id</td>
- <td align=\"center\" width=\"120\">$name</td>
- <td align=\"center\"><a href=\"http://ru.wowhead.com/item=$item\">$item_name</a></td>
- <td align=\"center\" width=\"90\">$item_count</td>
- <td align=\"center\" width=\"120\"><font color=\"gold\">$gold_bid г.</font> <font color=\"silver\">$silver_bid с.</font> <font color=\"coral\">$cooper_bid м.</font></td>
- <td align=\"center\" width=\"120\"><font color=\"gold\">$gold г.</font> <font color=\"silver\">$silver с.</font> <font color=\"coral\">$cooper м.</font></td>
- <td align=\"center\" width=\"120\">$time</td>
- </tr></table>";
- $id++;
- }
- print "<br><center>$paginate</center>";
- mysql_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment