Djivar
AKA Wickedviruz
Hi!
I am having some troubles with Znote acc and free premium.
I have activated free prem in config.lua
"freePremium = true"
And when an account is created on the website, the column "premium_ends_at" is set to 0.
i have tried to look at all possible ways. but i can not findout why it is not updated. i have checked the source code for the server, init.php, register.php but i can not find out why its not added as it should.
If you have any idea, where to look or want to see any scripts just tell me and i will post them!
this is the login check from init.php:
config.lua:
I am having some troubles with Znote acc and free premium.
I have activated free prem in config.lua
"freePremium = true"
And when an account is created on the website, the column "premium_ends_at" is set to 0.
i have tried to look at all possible ways. but i can not findout why it is not updated. i have checked the source code for the server, init.php, register.php but i can not find out why its not added as it should.
If you have any idea, where to look or want to see any scripts just tell me and i will post them!
this is the login check from init.php:
PHP:
$tfs_10_hasPremDays = true; // https://github.com/otland/forgottenserver/pull/2813
if (user_logged_in() === true) {
$session_user_id = getSession('user_id');
if ($config['ServerEngine'] !== 'OTHIRE') {
if ($config['ServerEngine'] == 'TFS_10') {
$hasPremDays = mysql_select_single("SHOW COLUMNS from `accounts` WHERE `Field` = 'premdays'");
if ($hasPremDays === false) {
$tfs_10_hasPremDays = false;
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premium_ends_at');
$user_data['premdays'] = ($user_data['premium_ends_at'] - time() > 0) ? floor(($user_data['premium_ends_at'] - time()) / 86400) : 0;
} else {
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
}
} else {
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
}
} else
$user_data = user_data($session_user_id, 'id', 'password', 'email', 'premend');
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
}
echo "Debug: Premdays calculated as " . $user_data['premdays'] . " (Premium ends at: " . date("Y-m-d H:i:s", $user_data['premium_ends_at']) . ", Current time: " . date("Y-m-d H:i:s") . ")";
config.lua:
Lua:
-- Misc.
-- NOTE: classicAttackSpeed set to true makes players constantly attack at regular
-- intervals regardless of other actions such as item (potion) use. This setting
-- may cause high CPU usage with many players and potentially affect performance!
-- NOTE: forceMonsterTypesOnLoad loads all monster types on startup to validate them.
-- You can disable it to save some memory if you don't see any errors at startup.
allowChangeOutfit = true
freePremium = true
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
emoteSpells = false
classicEquipmentSlots = true
classicAttackSpeed = false
showScriptsLogInConsole = false
showOnlineStatusInCharlist = true
yellMinimumLevel = 2
yellAlwaysAllowPremium = false
forceMonsterTypesOnLoad = true
cleanProtectionZones = false
luaItemDesc = false
showPlayerLogInConsole = true
Last edited: