Compare commits

...

25 Commits
1.6 ... master

Author SHA1 Message Date
Marek Madejski
dbc1e14ea7
Typo fix in login widget (#536)
Typo fix "userame".
2025-03-05 16:28:14 +01:00
Stefan A. Brannfjell
70a39d4cc7
Update cacert.pem
https://curl.se/docs/caextract.html
2024-02-25 21:12:50 +01:00
Emilianenko
001b12e762
Update guilds.php (#525)
https://otland.net/threads/znote-guilds-php-small-issue.282623/
2022-10-20 17:31:58 +02:00
Luan Luciano
9947d441b4
Update index.php (#522) 2022-08-02 12:07:23 +02:00
Luan Luciano
a67b03ba38
Fix function remainingTime (#521) 2022-08-02 12:07:04 +02:00
Stefan A. Brannfjell
cdaac6e974
Add gd image library to readme
installed through etc:
`apt install php-gd` or `apt install php7.4-gd`
2022-02-23 12:34:49 +01:00
Znote
78d35bb441 More accurate premium duration calculation.
Dont skimp on the hours on the last day the premium expires.
2022-01-29 23:01:03 +01:00
Michał "Gubihe
a531a18fad
Typo in footer.php (#504)
Fixed bug introduced in https://github.com/Znote/ZnoteAAC/pull/502
2022-01-21 13:23:05 +01:00
Michał "Gubihe
6d402cef28
microtime as float (#502) 2022-01-21 10:28:07 +01:00
Yujin Boby
4fb06fb4e5
make shop images work with SSL (https) (#501) 2022-01-17 11:10:04 +01:00
Znote
74890c1ea6 loginWebService correct pvptypes 2021-12-23 09:21:50 +01:00
Znote
88a13e6d10 Let admins bypass character list count restriction 2021-12-16 23:20:23 +01:00
Znote
47bbee9acf Fix #478 characterprofile message for pending deletions 2021-12-16 23:19:42 +01:00
Znote
0f4c67d37f Fix #497 Protocol 12 freePremium
having an account as free, make lots of weirds widgets to appear in game and even some client features unavailable.
This unlocks protocol 12 client features for servers who use freePremium in config.lua
2021-12-16 19:53:05 +01:00
Znote
52956f8dab Dont invoke IP validation if its disabled in config.php 2021-12-15 23:32:27 +01:00
Znote
f64d190e54 validate_ip bugfix 2021-12-15 23:31:02 +01:00
Znote
d5a11cbc76 SSL CA Root Certificates 2021-12-13 13:14:27 +01:00
Zbizu
7a9047da80 TFS 1.5 protocol 12 support 2021-12-09 02:21:01 +01:00
Evil Puncker
6be17886b3
Update config.php (#496) 2021-12-08 21:42:14 +01:00
Evil Puncker
3622ad173b
Lowering the size of onlinetime_ table sizes (#495)
MEDIUMINT: 97 days
MEDIUMINT UNSIGNED: 194.2 days
INT: 68 years
INT UNSIGNED: 136.1 years

bigint was way too big for these values, thanks to @divinity76
2021-11-19 02:44:12 +01:00
Evil Puncker
bb814f6eae
Fixed variable type for powergamers script (#492)
exp history should be able to store negative values, yes
online time shouldn't
2021-10-13 19:18:43 +02:00
Znote
ec55497c5a Fix img clipping in news feed 2021-07-24 05:17:14 +02:00
Stefan A. Brannfjell
563fa3a62b
Update README.md 2021-07-24 04:54:43 +02:00
Znote
541b95f926 minor adjustment to aside character search 2021-07-24 04:37:40 +02:00
Znote
32e5b6278e Fix #371 - fast APCu memory caching support 2021-07-24 00:38:58 +02:00
23 changed files with 1589 additions and 1385 deletions

View File

@ -25,23 +25,23 @@ end
-- SQL Query to execute: --
--[[
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
]]--
-- after that execute: --

View File

@ -25,23 +25,23 @@ end
-- SQL Query to execute: --
--[[
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
]]--
-- after that execute: --

View File

@ -13,13 +13,6 @@ We use github to distribute our versions, stable are tagged as releases, while d
* [Stable](https://github.com/Znote/ZnoteAAC/releases)
* [Development](https://github.com/Znote/ZnoteAAC/archive/master.zip)
### Compatible OT distributions
Znote AAC primarily aims to be compatible with [Forgotten Server](https://github.com/otland/forgottenserver)
Forgotten Server is commonly known as TFS (The Forgotten Server) and Znote AAC supports these versions:
* TFS 0.2.13+ (Since initial release)
* TFS 0.3.6+ (Since Znote AAC 1.2)
* TFS 1.2+ (Since Znote AAC 1.5)
### Requirements
* PHP Version 5.6 or higher. Mostly tested on 5.6 and 7.4. Most web stacks ships with this as default these days.
@ -27,6 +20,7 @@ Forgotten Server is commonly known as TFS (The Forgotten Server) and Znote AAC s
* For email registration verification and account recovery: [PHPMailer](https://github.com/PHPMailer/PHPMailer/releases) Version 6.x, extracted and renamed to just "PHPMailer" in Znote AAC directory.
* PHP extension curl for PHPMailer, paypal and google reCaptcha services.
* PHP extension openssl for google reCaptcha services.
* PHP extension gd for guild logos.
### Installation instructions
@ -54,11 +48,15 @@ This will show you the rest of the instructions as well as the mysql schema.
Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer.
#### Server distribution compatibility:
- OTHire
- TFS 0.2
- TFS 0.3/4
- TFS 1.x
- Distributions based on these (such as OTX).
- [Znote AAC 1.6](https://github.com/Znote/ZnoteAAC/releases/tag/1.6)
- OTHire
- TFS 0.2
- TFS 0.3/4
- TFS 1.3
- Distributions based on these (such as OTX).
- Znote AAC 2.0 [v2 dev branch](https://github.com/Znote/ZnoteAAC/tree/v2)
- TFS 1.4
- OTservBR-Global
#### General
- Server wide latest death list

View File

@ -54,6 +54,7 @@ if (user_logged_in()) {
<h1>Changelog</h1>
<?php
$cache = new Cache('engine/cache/changelog');
$cache->useMemory(false);
if ($updateCache === true) {
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");

View File

@ -87,6 +87,13 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<td>Position</td>
<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
</tr>
<?php endif;
// pending deletion?
$deletion_time = mysql_select_single("SELECT `time` FROM `znote_deleted_characters` WHERE `character_name`='{$name}' AND `done` = '0' LIMIT 1;");
if ($deletion_time !== false): ?>
<tr>
<td colspan="2" style="color: red;">Flagged for deletion by owner after <?php echo $deletion_time['time']; ?>.</td>
</tr>
<?php endif; ?>
<!-- Player male / female -->
<tr>

View File

@ -537,6 +537,7 @@
// Minimum allowed letters in character name. Ex: 4 letters: "Kare".
$config['minL'] = 3;
// Maximum allowed letters in character name. Ex: 20 letters: "Bobkareolesofiesberg"
// Pre QT clients (lower than version 11) support only 20 letters max, while newer clients support up to 25
$config['maxL'] = 20;
// Maximum allowed words in character name. Ex: 2 words = "Bob Kare", 3 words: "Bob Arne Kare" as maximum char name words.
$config['maxW'] = 3;
@ -657,9 +658,18 @@
'port' => 7172,
'name' => 'Forgotten' // Must be identical to config.lua (OT config file) server name.
);
// Unlock all protocol 12 client features? Free premium in config.lua? Then set this to true.
$config['freePremium'] = true;
// How often do you want highscores to update?
$config['cache_lifespan'] = 5; // 60 * 15; // 15 minutes.
// How often do you want highscores (cache) to update?
$config['cache'] = array(
// If you have two instances installed on same server, make each instance prefix unique
'prefix' => 'znote_',
// 60 * 15; // 15 minutes.
'lifespan' => 5,
// Store cache in memory/RAM? Requires PHP extension APCu
'memory' => true
);
// WARNING! Account names written here will have admin access to web page!
$config['page_admin_access'] = array(

View File

@ -67,7 +67,7 @@ if (empty($_POST) === false) {
}
// Char count
$char_count = user_character_list_count($session_user_id);
if ($char_count >= $config['max_characters']) {
if ($char_count >= $config['max_characters'] && !is_admin($user_data)) {
$errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
}
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,8 @@ if (!function_exists("elapsedTime")) {
if ($l_start === false) global $l_start;
if ($l_time === false) global $l_time;
$l_time = explode(' ', microtime());
$l_finish = $l_time[1] + $l_time[0];
return round(($l_finish - $l_start), 4);
$l_time = microtime(true);
return round(($l_time - $l_start), 4);
}
}

View File

@ -1,11 +1,8 @@
<footer>
&copy; Znote AAC.
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$finish = microtime(true);
$total_time = round(($finish - $start), 4);
echo 'Server date and clock is: '. getClock(false, true) .' Page generated in '. $total_time .' seconds. ';
?>
</footer>
</footer>

View File

@ -1,122 +1,167 @@
<?php
class Cache
{
protected $_file = false;
protected $_lifespan = 0;
protected $_content;
class Cache
{
protected $_file = false;
protected $_lifespan = 0;
protected $_content;
protected $_memory = false;
protected $_canMemory = false;
const EXT = '.cache.php';
const EXT = '.cache.php';
/**
* @param string $file
* @access public
* @return void
**/
public function __construct($file) {
$this->_file = $file . self::EXT;
$this->setExpiration(config('cache_lifespan'));
/**
* @param string $file
* @access public
* @return void
**/
public function __construct($file) {
$cfg = config('cache');
$this->setExpiration($cfg['lifespan']);
if (function_exists('apcu_fetch')) {
$this->_canMemory = true;
$this->_memory = $cfg['memory'];
}
$this->_file = $file . self::EXT;
if (!$this->_memory && $cfg['memory']) die("
<p><strong>Configuration error!</strong>
<br>Cannot save cache to memory, but it is configured to do so.
<br>You need to enable PHP extension APCu to enable memory cache.
<br>Install it or set \$config['cache']['memory'] to false!
<br><strong>Ubuntu install:</strong> sudo apt install php-apcu</p>
");
}
/**
* Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
*
* @param integer $span
* @access public
* @return void
**/
public function setExpiration($span) {
$this->_lifespan = $span;
}
/**
* Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
*
* @param integer $span
* @access public
* @return void
**/
public function setExpiration($span) {
$this->_lifespan = $span;
}
/**
* Set the content you'd like to cache.
*
* @param mixed $content
* @access public
* @return void
**/
public function setContent($content) {
switch (strtolower(gettype($content))) {
case 'array':
$this->_content = json_encode($content);
break;
default:
$this->_content = $content;
break;
}
}
/**
* Validates whether it is time to refresh the cache data or not.
*
* @access public
* @return boolean
**/
public function hasExpired() {
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
return false;
}
/**
* Enable or disable memory RAM storage.
*
* @param bool $bool
* @access public
* @return bool $status
**/
public function useMemory($bool) {
if ($bool and $this->_canMemory) {
$this->_memory = true;
return true;
}
$this->_memory = false;
return false;
}
/**
* Returns remaining time before scoreboard will update itself.
*
* @access public
* @return integer
**/
public function remainingTime() {
$remaining = 0;
if (!$this->hasExpired()) {
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
/**
* Set the content you'd like to cache.
*
* @param mixed $content
* @access public
* @return void
**/
public function setContent($content) {
$this->_content = (!$this->_memory && strtolower(gettype($content)) == 'array') ? json_encode($content) : $content;
}
/**
* Validates whether it is time to refresh the cache data or not.
*
* @access public
* @return boolean
**/
public function hasExpired() {
if ($this->_memory) {
return !apcu_exists($this->_file);
}
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
return false;
}
return true;
}
/**
* Returns remaining time before scoreboard will update itself.
*
* @access public
* @return integer
**/
public function remainingTime() {
$remaining = 0;
if ($this->_memory) {
if (apcu_exists($this->_file)) {
$meta = apcu_cache_info();
foreach ($meta['cache_list'] AS $item) {
if ($item['info'] == $this->_file) {
$remaining = ($item['creation_time'] + $item['ttl']) - time();
return ($remaining > 0) ? $remaining : 0;
}
}
}
return $remaining;
}
if (!$this->hasExpired()) {
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
}
return $remaining;
}
/**
* Saves the content into its appropriate cache file.
*
* @access public
* @return void
**/
public function save() {
$handle = fopen($this->_file, 'w');
fwrite($handle, $this->_content);
fclose($handle);
/**
* Saves the content into its appropriate cache file.
*
* @access public
* @return void
**/
public function save() {
if ($this->_memory) {
return apcu_store($this->_file, $this->_content, $this->_lifespan);
}
$handle = fopen($this->_file, 'w');
fwrite($handle, $this->_content);
fclose($handle);
}
/**
* Loads the content from a specified cache file.
*
* @access public
* @return mixed
**/
public function load() {
if ($this->_memory) {
return apcu_fetch($this->_file);
}
if (!is_file($this->_file)) {
return false;
}
ob_start();
include_once($this->_file);
$content = ob_get_clean();
/**
* Loads the content from a specified cache file.
*
* @access public
* @return mixed
**/
public function load() {
if (!is_file($this->_file)) {
return false;
}
if (!isset($content) && strlen($content) == 0) {
return false;
}
ob_start();
include_once($this->_file);
$content = ob_get_clean();
if (!isset($content) && strlen($content) == 0) {
return false;
}
if ($content = json_decode($content, true)) {
return (array) $content;
} else {
return $content;
}
if ($content = json_decode($content, true)) {
return (array) $content;
} else {
return $content;
}
}
}

View File

@ -231,7 +231,7 @@ function validate_name($string) {
// Checks if an IPv4(or localhost IPv6) address is valid
function validate_ip($ip) {
$ipL = safeIp2Long($ip);
$ipR = long2ip($ipL);
$ipR = long2ip((int)$ipL);
if ($ip === $ipR) {
return true;

View File

@ -1125,13 +1125,13 @@ function user_account_add_premdays($accid, $days) {
} else {
mysql_update(" UPDATE `accounts`
SET `premdays` = `premdays`+{$days}
,`lastday` = GREATEST(`lastday`,UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
,`lastday` = GREATEST(`lastday`,UNIX_TIMESTAMP()) + ({$days} * 86400)
WHERE `id`='{$accid}'
");
}
} else {
mysql_update(" UPDATE `accounts`
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP()) + ({$days} * 86400)
WHERE `id`='{$accid}';
");
}

View File

@ -1,8 +1,6 @@
<?php if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.');
$l_time = microtime();
$l_time = explode(' ', $l_time);
$l_time = $l_time[1] + $l_time[0];
$l_time = microtime(true);
$l_start = $l_time;
function elapsedTime($l_start = false, $l_time = false) {

View File

@ -276,22 +276,23 @@ if (user_logged_in() === true) {
<table>
<tr class="yellow">
<td>Name:</td>
<?php
if ($highest_access == 2 || $highest_access == 3) {
echo '<td>Remove:</td>';
}
// Shuffle through visitor characters
for ($i = 0; $i < $char_count; $i++) {
$exist = false;
// Shuffle through invited character, see if they match your character.
if ($inv_data !== false) foreach ($inv_data as $inv) {
if ($charactersId[$i] == $inv['player_id']) {
$exist = true;
}
}
if ($exist) echo '<td>Join Guild:</td><td>Reject Invitation:</td>';
}
?>
<?php
if ($highest_access == 2 || $highest_access == 3) {
echo '<td>Remove:</td>';
}
// Shuffle through visitor characters
$exist = false;
for ($i = 0; $i < $char_count; $i++) {
// Shuffle through invited character, see if they match your character.
if ($inv_data !== false) foreach ($inv_data as $inv) {
if ($charactersId[$i] == $inv['player_id']) {
$exist = true;
break;
}
}
}
if ($exist) echo '<td>Join Guild:</td><td>Reject Invitation:</td>';
?>
</tr>
<?php
$bool = false;

View File

@ -1,4 +1,4 @@
<?php if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0") { require_once 'login.php'; die(); } // Client 11 loginWebService
<?php if(isset($_SERVER["HTTP_USER_AGENT"]) && $_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0") { require_once 'login.php'; die(); } // Client 11 loginWebService
require_once 'engine/init.php'; include 'layout/overall/header.php';
if (!isset($_GET['page'])) {
@ -15,6 +15,7 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
// Changelog ticker //
// Load from cache
$changelogCache = new Cache('engine/cache/changelog');
$changelogCache->useMemory(false);
$changelogs = $changelogCache->load();
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {

View File

@ -229,6 +229,9 @@ table, .header, .well, .smedia a {
}
/* Znote AAC */
.leftPane img {
max-width: 100%;
}
/* adding button style to select */
select {
background: rgb(15,17,20);

View File

@ -4,6 +4,7 @@ if ($config['UseChangelogTicker']) {
// Changelog ticker //
// Load from cache
$changelogCache = new Cache('engine/cache/changelog');
$changelogCache->useMemory(false);
$changelogs = $changelogCache->load();
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {

View File

@ -29,7 +29,7 @@
}
?>
<script type="text/javascript">
window.searchNames = <?php echo json_encode($names)?>;
window.searchNames = <?php echo json_encode($names); ?>;
$(function() {
if (window.searchNames.length > 0) {
$('#src_name').keyup(function(e) {

View File

@ -5,7 +5,7 @@
<div class="body">
<form class="loginForm" action="login.php" method="post">
<div class="well">
<label for="login_username">Userame:</label> <input type="text" name="username" id="login_username">
<label for="login_username">Username:</label> <input type="text" name="username" id="login_username">
</div>
<div class="well">
<label for="login_password">Password:</label> <input type="password" name="password" id="login_password">

View File

@ -154,7 +154,7 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
$password = SHA1($client->password);
$token = (isset($client->token)) ? sanitize($client->token) : false;
$fields = '`id`, `premdays`';
$fields = '`id`, `premium_ends_at`';
if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';
$account = false;
@ -213,8 +213,10 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
}
$sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
if (isset($account['secret']) && strlen($account['secret']) > 5) $sessionKey .= "\n".$token."\n".floor(time() / 30);
$sessionKey .= (isset($account['secret']) && strlen($account['secret']) > 5) ? "\n".$token : "\n";
$sessionKey .= "\n".floor(time() / 30);
$freePremium = (isset($config['freePremium'])) ? $config['freePremium'] : true;
$response = array(
'session' => array(
'fpstracking' => false,
@ -226,8 +228,8 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
'emailcoderequest' => false,
'sessionkey' => $sessionKey,
'lastlogintime' => 0,
'ispremium' => ($account['premdays'] > 0) ? true : false,
'premiumuntil' => time() + ($account['premdays'] * 86400),
'ispremium' => ($account['premium_ends_at'] > time() || $freePremium) ? true : false,
'premiumuntil' => $account['premium_ends_at'],
'status' => 'active'
),
'playdata' => array(
@ -239,7 +241,13 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
'externalport' => $gameserver['port'],
'previewstate' => 0,
'location' => 'ALL',
'pvptype' => 'pvp',
// 0 - open pvp
// 1 - optional
// 2 - hardcore
// 3 - retro open pvp
// 4 - retro hardcore pvp
// 5 and higher - (unknown)
'pvptype' => 0,
'externaladdressunprotected' => $gameserver['ip'],
'externaladdressprotected' => $gameserver['ip'],
'externalportunprotected' => $gameserver['port'],

View File

@ -80,12 +80,14 @@ if (empty($_POST) === false) {
if ($_POST['selected'] != 1) {
$errors[] = 'You are only allowed to have an account if you accept the rules.';
}
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
if ($config['validate_IP'] === true) {
if (validate_ip(getIP()) === false) {
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
}
}
if (strlen($_POST['flag']) < 1) {
$errors[] = 'Please choose country.';
}
if (strlen($_POST['flag']) < 1) {
$errors[] = 'Please choose country.';
}
}
}

View File

@ -220,7 +220,7 @@ foreach ($shop_list as $key => $offer) {
<tr class="special">
<td><?php echo $offers['description']; ?></td>
<?php if ($config['shop']['showImage']):?>
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<?php endif; ?>
<td><?php echo $offers['count']; ?>x</td>
<td><?php echo $offers['points']; ?></td>
@ -251,7 +251,7 @@ foreach ($shop_list as $key => $offer) {
<tr class="special">
<td><?php echo $offers['description']; ?></td>
<?php if ($config['shop']['showImage']):?>
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<?php endif; ?>
<td><?php echo $offers['count']; ?> Days</td>
<td><?php echo $offers['points']; ?></td>
@ -351,7 +351,7 @@ foreach ($shop_list as $key => $offer) {
<tr class="special">
<td><?php echo $offers['description']; ?></td>
<?php if ($config['shop']['showImage']):?>
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
<?php endif;
if ($offers['count'] === 0): ?>
<td>Unlimited</td>