Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- ob_start('ob_gzhandler');
- if($_SERVER['REMOTE_ADDR'] !== '31.185.125.145')
- error_reporting(0);
- $time = microtime(true);
- if(!isset($_GET['subtopic']) || !($subtopic = $_GET['subtopic'])) {
- $subtopic = 'latestnews';
- }
- foreach(array(
- 'home' => array('latestnews' => 'Latest News'/*, 'archive' => 'News Archive'*/),
- 'account' => array('accountmanagement' => 'Account Management', 'createaccount' => 'Create Account', 'downloads' => 'Downloads', 'lostaccount' => 'Lost Account?'),
- 'community' => array('characters' => 'Characters', 'whoisonline' => 'Who is online?', 'highscores' => 'Highscores', 'houses' => 'Houses', 'guilds' => 'Guilds', 'guildwars' => 'Guild Wars', 'deaths' => 'Latest Deaths', 'frags' => 'Top Fraggers', 'addonmakers' => 'Addonmakers', 'questmakers' => 'Top Questmakers'/*, 'elo' => 'Elo Ranking'*/, 'achievements' => 'Achievements'),
- 'library' => array('achievements' => 'Achievements', 'serverinfo' => 'Serverinfo', 'items' => 'Items', 'mounts' => 'Mounts', 'tasks' => 'Tasks', 'topcountries' => 'Top Countries', 'killstatistics' => 'Kill Statistics'/*, 'zombie' => 'Zombie Highscores'*/, 'bans' => 'Ban List', 'topguilds' => 'Top Guilds', 'polls' => 'Polls', 'pg' => 'Powergamers', 'experiencetable' => 'Experience Table'),
- 'forum' => array('forum' => 'Forum Board','ticket' => 'Ticket Board'),
- 'shop' => array('buycoins' => 'Buy Coins', 'shop' => 'Donation Gifts', 'egypt' => 'Vodafone', 'shophistory' => 'Shop History', 'pay' => 'PayPal', 'bitcoin' => 'Bitcoin', 'paygol' => 'PayGol', 'payg' => 'PayG', 'paygol_f' => 'PayGol Success', 'paygol_c' => 'PayGol Failure', 'paygol_lt' => 'PayGol', 'paygol_lt_f' => 'PayGol Success', 'paygol_lt_c' => 'PayGol Failure'/*, 'polls' => 'Polls'*/),
- 'help' => array('ticketroom' => 'Ticket Room','faq' => 'FAQ', 'rules' => 'Server Rules', 'staff' => 'Staff'),
- 'admin' => array('adminpanel' => 'Admin Panel', 'shopadmin' => 'Shop Admin', 'changes' => 'Changes', 'codes' => 'Code Generator')
- ) as $k => $v) {
- foreach($v as $a => $b) {
- if($a === $subtopic) {
- $topic = array($k, $b);
- unset($k, $v, $a, $b);
- break;
- }
- }
- }
- if(!isset($topic)) {
- header('Location: /news');
- exit;
- }
- session_start();
- $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL;
- $SQL = NULL; $qn=0; $qtime=0; $qstr = '';
- require 'config.php';
- function connect() {
- global $host, $dbname, $user, $pass;
- try {
- $GLOBALS['SQL'] = new PDO('mysql:host='.$host.';dbname='.$dbname, $user, $pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::MYSQL_ATTR_COMPRESS => true, PDO::ATTR_PERSISTENT => true));
- }
- catch(PDOException $e) {
- die($e->getMessage());
- }
- }
- function query($q) {
- global $SQL;
- if($SQL === NULL)
- connect();
- ++$GLOBALS['qn'];
- $t = microtime(true);
- $res = $q[0] === 'S' ? $SQL->query($q) : $SQL->exec($q);
- $t = microtime(true) - $t;
- $GLOBALS['qtime'] += $t;
- return $res;
- }
- function quote($s) {
- global $SQL;
- if($SQL === NULL)
- connect();
- return $SQL->quote($s);
- }
- function lastInsertId() {
- global $SQL;
- if($SQL === NULL)
- connect();
- return $SQL->lastInsertId();
- }
- function redir($s) {
- header('Location: '.$s);
- exit;
- }
- function check_account_name($s) {
- $l = strlen($s);
- return $l >= 1 && $l <= 30 && strspn($s, 'QWERTYUIOPASDFGHJKLZXCVBNM0123456789') === $l;
- }
- function check_password($s) {
- $l = strlen($s);
- return $l >= 1 && $l <= 30 && strspn($s, 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789_') === $l;
- }
- function check_name($s) {
- $l = strlen($s);
- return $l >= 3 && $l <= 25 && strspn($s, 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM \'') === $l;
- }
- function timestr($t) {
- define('YEAR', 365 * 86400);
- define('MONTH', 30 * 86400);
- define('WEEK', 7 * 86400);
- define('DAY', 86400);
- define('HOUR', 3600);
- define('MINUTE', 60);
- if($t >= time())
- $t = $t - time();
- else
- $t = time() - $t;
- if($t >= YEAR) {
- $t = (int)($t / YEAR);
- $s = 'year';
- }
- elseif($t >= MONTH) {
- $t = (int)($t / MONTH);
- $s = 'month';
- }
- elseif($t >= WEEK) {
- $t = (int)($t / WEEK);
- $s = 'week';
- }
- elseif($t >= DAY) {
- $t = (int)($t / DAY);
- $s = 'day';
- }
- elseif($t >= HOUR) {
- $t = (int)($t / HOUR);
- $s = 'hour';
- }
- elseif($t >= MINUTE) {
- $t = (int)($t / MINUTE);
- $s = 'minute';
- }
- else
- $s = 'second';
- return $t .' '.$s.($t === 1 ? '' : 's');
- }
- if($subtopic === 'accountmanagement' && isset($_GET['page']) && $_GET['page'] === 'logout')
- session_unset();
- elseif($subtopic === 'createaccount' && isset($_POST['step']) && $_POST['step'] === 'docreate') {
- include('pages/createaccount2.inc');
- }
- $logged = false; $gid = 0;
- if(isset($_SESSION['account'])) {
- $acc = $_SESSION['account'];
- $pw = $_SESSION['password'];
- $first = false;
- }
- elseif(isset($_POST['account_login']) && isset($_POST['password_login'])) {
- $acc = strtoupper($_POST['account_login']);
- $pw = $_POST['password_login'];
- $first = true;
- }
- if(isset($acc)) {
- if( !$first || (check_account_name($acc) && check_password($pw)) ) {
- if($first) {
- if($sha1)
- $a = query("SELECT id FROM accounts WHERE name = '$acc' AND password=SHA1(CONCAT(salt, ".quote($pw)."))");
- else
- $a = query("SELECT id FROM accounts WHERE name = '$acc' AND password=".quote($pw));
- }
- else {
- if($sha1)
- $a = query("SELECT id,name,password,premdays,email,`key`,premium_points,page_access,page_lastday,last_post,created,vote FROM accounts WHERE id = $acc AND password=SHA1(CONCAT(salt, ".quote($pw)."))");
- else
- $a = query("SELECT id,name,password,premdays,email,`key`,premium_points,page_access,page_lastday,last_post,created,vote FROM accounts WHERE id = $acc AND password=".quote($pw));
- }
- if($a = $a->fetch()) {
- if($first) {
- query('UPDATE accounts SET page_lastday='.time().' WHERE id='.$a['id']);
- $_SESSION['account'] = $a['id'];
- $_SESSION['password'] = $pw;
- redir($_POST['redirect'] ?: '/account');
- }
- $logged = true;
- $gid = (int)$a['page_access'];
- if(!isset($_SESSION['country']))
- $_SESSION['country'] = strtolower(query('SELECT cc FROM geoip WHERE end>='.ip2long($_SERVER['REMOTE_ADDR']).' LIMIT 1')->fetchColumn());
- if(0 /*$gid === 3 && !in_array($_SESSION['country'], Array('eg','at'))*/) {
- exit;
- }
- }
- }
- if(!$logged) {
- if($first)
- $lfail = true;
- else
- session_unset();
- }
- }
- $stat = explode('|', file_get_contents('cache/status.tmp'));
- function active($opt) {
- if($GLOBALS['subtopic'] === $opt)
- echo ' class="active"';
- }
- function menu($opt) {
- if($GLOBALS['topic'][0] === $opt)
- echo 'active';
- } ?>
- <!DOCTYPE html>
- <div id="countdown_timer">
- <? require 'pages/countdown.inc'; ?>
- </div>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><? echo $topic[1]; ?> - <?=$sname?></title>
- <link rel="stylesheet" href="<? echo $layout_name; ?>/style.css?<?=filemtime('style.css')?>" type="text/css" />
- <script type="text/javascript" src="<? echo $layout_name; ?>/menu.js?<?=filemtime('menu.js')?>"></script>
- <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
- <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
- <script src="snow.js"></script>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
- <script type="text/javascript">
- var imagesURL = '<? echo $layout_name; ?>';
- $(document).ready(function(){
- $('.ticket_close').click(function(){
- $.ajax({
- url:'/pages/ticket_close.php',
- type:'post',
- data:'tid='+$(this).attr('data-tid')+'&gid='+$(this).attr('data-gid')+'&action='+$(this).attr('data-action'),
- success: function(data){
- $('.ticket_top_msg > .errfield').html("");
- if(data[0] == 'err#req'){
- $('.ticket_top_msg > .errfield').html('<div class="well errmsg">Authorization error occured!</div>');
- } else if (data[0] == 'fail') {
- $('.ticket_top_msg > .errfield').html('<div class="well errmsg">Could not mark ticket as '+(data[1] == 'mark' ? 'solved!':'pending!')+'</div>');
- } else if (data[0] == 'success') {
- $('.ticket_top_msg > .errfield').html('<div class="well errmsg">Ticket has been marked as '+(data[1] == 'mark' ? 'solved!':'pending!')+'</div>');
- }
- }
- });
- });
- $('#ticketForm').submit(function(event){
- $.ajax({
- url:'/pages/ticket_process.php',
- type:'post',
- data:$('#ticketForm').serialize(),
- success: function(data){
- $('.newTicket_err').html("");
- if(data[0] == 'err#sess'){
- $('.newTicket_err').prepend('<div class="well errmsg">You have to be <a href="/?subtopic=accountmanagement">logged in</a> first.</div>');
- } else if(data[0] == 'err#missing') {
- $('.newTicket_err').prepend('<div class="well errmsg">missing info: author_id | title</div>');
- } else if(data[0] == 'err#ticketInsert') {
- $('.newTicket_err').prepend('<div class="well errmsg">Could not create ticket! Please contact admin.</div>');
- } else if(data[0] == 'err#query') {
- $('.newTicket_err').prepend('<div class="well errmsg">Something went wrong. Please contact admin.</div>');
- } else if (data[0] == 'err#lasttime') {
- $('.newTicket_err').prepend('<div class="well errmsg">You can only create a ticket every 12h</div>');
- } else if(data[0] == 'success') {
- $('.newTicket_err').prepend('<div class="well succmsg">Your ticket has been created!</div>');
- $('#ticketForm textarea, #ticketForm input[name="title"]').val("");
- $('.pending_tickets').append('\
- <tr>\
- <td>'+data[2]+'</td>\
- <td colspan="1">\
- <span class="pending">\
- PENDING</span>\
- </td>\
- <td><a href="/?subtopic=ticketroom&tid='+data[3]+'">'+data[1]+'</a></td>\
- <td><?=date("Y-m-d h:m:s", time())?></td>\
- </tr>');
- }
- }
- });
- event.preventDefault();
- });
- $('#ticketResponse').submit(function(event){
- $.ajax({
- url:'/pages/ticket_resp.php',
- type:'post',
- dataType:'json',
- data:$('#ticketResponse').serialize(),
- success:function(data){
- $('.ticket_response > .errfield').html("");
- if(data[0] == 'success'){
- $('.ticket_response > .errfield').html("");
- $('.ticket_msg_c').append('\
- <div class="message_c">\
- <div>\
- <span class="message" style="float:right;background:green;">\
- <div class="message_plain">\
- '+data[1]+'\
- </div>\
- <div class="message_time">\
- <span><?=date("Y-m-d h:m:s", time())?></span>\
- </div>\
- </span>\
- </div>\
- </div>');
- // reset input value
- $('input[name="resp_msg"]').val("");
- $('.ticket_msg_c').scrollTop($('.ticket_msg_c')[0].scrollHeight);
- } else if (data[0] == 'fail') {
- $('.ticket_response > .errfield').prepend('<div class="well errmsg">Something went wrong. Please contact admin.</div>');
- } else if (data[0] == 'err#sess') {
- $('.ticket_response > .errfield').prepend('<div class="well errmsg">You have to be <a href="/?subtopic=accountmanagement">logged in</a>!.</div>');
- } else if (data[0] == 'err#missingField') {
- $('.ticket_response > .errfield').prepend('<div class="well errmsg">Some data is missing!</div>');
- } else if (data[0] == 'err#alreadySolved') {
- $('.ticket_response > .errfield').prepend('<div class="well errmsg">!! This ticket has been closed by administrators !!</div>');
- }
- }
- });
- event.preventDefault();
- event.stopPropagation();
- });
- });
- </script>
- </head>
- </script>
- <? echo $layout_header; ?>
- </head>
- <body onload="menuInit();">
- <div id="page">
- <!-- HOLD ALL ON CENTER -->
- <div id="header"></div>
- <div id="menu">
- <div style="margin-bottom: -2px;"><img src="<? echo $layout_name; ?>/images/menu-start.png" alt="Start Menu" /></div>
- <div id="news">
- <div onclick="menuSwitch(1, 'news')">
- <div class="maydela">
- <div style="float: left; width: 157px; height: 34px;"><img src="<? echo $layout_name; ?>/" alt="" /></div>
- <div id="news_Icon" style="background-image: url('<? echo $layout_name; ?>/images/minus.gif'); background-position: bottom right; background-repeat: no-repeat; float: left; width: 23px; height: 34px;"></div>
- </div>
- </div>
- <div id="news_Submenu">
- <div class="links">
- <ul>
- <li><a href="/?subtopic=latestnews">Latest News</a></li>
- <li><a href="/?subtopic=topcountries">Top Countries</a></li>
- </ul>
- </div>
- </div>
- </div>
- <div id="account">
- <div onclick="menuSwitch(2, 'account')">
- <div class="maydelaa">
- <div style="float: left; width: 157px; height: 34px;"><img src="<? echo $layout_name; ?>/" alt="" /></div>
- <div id="account_Icon" style="background-image: url('<? echo $layout_name; ?>/images/plus.gif'); background-position: bottom right; background-repeat: no-repeat; float: left; width: 23px; height: 34px;"></div>
- </div>
- </div>
- <div id="account_Submenu">
- <div class="links">
- <ul>
- <?PHP
- if($gid >= 3)
- echo '<li><a href="/?subtopic=adminpanel">Admin Panel</a></li>';
- if($gid > 0)
- echo '<li><a href="/?subtopic=namelock">Namelocks</a></li>';
- if($logged)
- {
- echo '<li><a href="/?subtopic=accountmanagement">My Account</a></li>
- <li><a href="/?subtopic=ticket">Create Ticket</a></li>
- <li><a href="/?subtopic=accountmanagement&page=logout">Logout</a></li>';
- }
- else
- {
- echo '<li><a href="/?subtopic=accountmanagement">Login</a></li>';
- }
- ?>
- <li><a href="/?subtopic=createaccount">Create Account</a></li>
- <li><a href="/?subtopic=lostaccount">Lost Account Interface</a></li>
- <li><a href="/?subtopic=rules">Server Rules</a></li>
- </ul>
- </div>
- </div>
- </div>
- <div id="community">
- <div onclick="menuSwitch(3, 'community')">
- <div class="maydelaaa">
- <div style="float: left; width: 157px; height: 34px;"><img src="<? echo $layout_name; ?>/" alt="" /></div>
- <div id="community_Icon" style="background-image: url('<? echo $layout_name; ?>/images/plus.gif'); background-position: bottom right; background-repeat: no-repeat; float: left; width: 23px; height: 34px;"></div>
- </div>
- </div>
- <div id="community_Submenu">
- <div class="links">
- <ul>
- <li><a href="/?subtopic=characters">Search Player</a></li>
- <li><a href="/?subtopic=guilds">Guilds</a></li>
- <li><a href="/?subtopic=highscores"><b><font size="1" color="yellow"><blink>Top Level</blink></font></b></a></li>
- <li><a href="/?subtopic=killstatistics">Last Deaths</a></li>
- <li><a href="/?subtopic=frags"><b><font size="1" color="red"><blink>Top Fraggers</blink></font></b></a></li>
- <li><a href="/wars"><b><font size="1" color="green"><blink>Guild War</blink></font></b></a></li>
- <li><a href="/?subtopic=topguilds">Top Guilds</a></li>
- <li><a href="/?subtopic=houses">Houses</a></li>
- <li><a href="/?subtopic=downloads">Download</a></li>
- <li><a href="/?subtopic=forum">Forum</a></li>
- <li><a href="/achievements">Achievements</a></li>
- <li><a href="/?subtopic=staff">Game Masters</a></li>
- </ul>
- </div>
- </div>
- </div>
- <div id="library">
- <div onclick="menuSwitch(4, 'library')">
- <div class="maydelaaaa">
- <div style="float: left; width: 157px; height: 34px;"><img src="<? echo $layout_name; ?>/" alt="" /></div>
- <div id="library_Icon" style="background-image: url('<? echo $layout_name; ?>/images/plus.gif'); background-position: bottom right; background-repeat: no-repeat; float: left; width: 23px; height: 34px;"></div>
- </div>
- </div>
- <div id="library_Submenu">
- <div class="links">
- <ul>
- <!--li><a href="/?subtopic=creatures">Monsters</a></li>
- <li><a href="/?subtopic=spells">Spells</a></li-->
- <li><a href="/?subtopic=whoisonline">Who is online?</a></li>
- <li><a href="/?subtopic=serverinfo">Server Info</a></li>
- <li><a href="/?subtopic=downloads">Downloads</a></li>
- </ul>
- </div>
- </div>
- </div>
- <div id="shops">
- <div onclick="menuSwitch(5, 'shops')">
- <div class="maydelaaaaa">
- <div style="float: left; width: 157px; height: 34px;"><img src="<?=$layout_name?>/" alt="" /></div>
- <div id="shops_Icon" style="background-image: url('<?=$layout_name?>/images/plus.gif'); background-position: bottom right; background-repeat: no-repeat; float: left; width: 23px; height: 34px;"></div>
- </div>
- </div>
- <div id="shops_Submenu">
- <div class="links">
- <ul>
- <li><a href="/?subtopic=buycoins"><b><font size="1" color="red"><blink>Buy Premium Points</blink></font></b></a></li>
- <li><a href="/?subtopic=shop">Shop Offer</a></li>';
- <? if($logged) { ?>
- <li><a href="/?subtopic=shophistory">Shop History</a></li>
- <? } ?>
- </ul>
- </div>
- </div>
- </div>
- <div style="margin-top: -2px;"><img src="<? echo $layout_name; ?>/images/menu-end.png" alt="End Menu" /></div>
- </div>
- <div id="cnt-box">
- <div id="top"></div>
- <div id="mid">
- <div id="margins">
- <? if(in_array($subtopic, array('paygol','paygol_f','paygol_c')))
- include('pages/paygol/pay.php');
- elseif(in_array($subtopic, array('paygol_lt','paygol_lt_f','paygol_lt_c')))
- include('pages/paygol/pay_lt.php');
- else
- include('pages/'.$subtopic.'.inc'); ?>
- </div>
- </div>
- <div id="bot"></div>
- <div id="copyrights" style="color: #efe;">
- <p>© <?=date('Y')?> by <? echo $sname; ?>. All Rights Reserved.</p>
- <p>Served by <?=$_SERVER['SERVER_ADDR']?> with <?=$qn?> queries in <?=round(microtime(true) - $time, 4)?>s.</p>
- </div>
- </div>
- <div id="status">
- <img src="<? echo $layout_name; ?>/images/statess.png" alt="Premium Banner" style="border: 0px;" />
- <div id="maydala">
- <hr noshade="noshade" size="1" />
- <?PHP
- if($stat[0] == 1)
- echo '
- <h3>Server Status: <img style="vertical-align:middle;" src="/online.png"></h3>
- <h3><font color="red">Players Online: '.$stat[1].' / '.$stat[2].'<br /></font></h3>
- <font color="yellow">Monsters: '.$stat[4].'<br />Uptime: '.$stat[5].'<br /></font>
- <font color="yellow">IP:</font> '.$_SERVER['HTTP_HOST'].'<br />
- <font color="yellow">PORT:</h3> 7171';
- else
- echo '<font color="red"><b>Server Offline</b></font>';
- ?>
- <hr noshade="noshade" size="1" />
- <a href="https://discord.gg/ARGVmpb"><img src="<? echo $layout_name; ?>/img/discord.png" alt="Premium Banner" style="border: 0px;" /></a>
- </div>
- <!-- END -->
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement