[go: up one dir, main page]

Menu

[fb6781]: / common.php  Maximize  Restore  History

Download this file

112 lines (94 with data), 2.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/*
* common.php
*
* Common init file
*
* @version 1.1 Security checks by Gorlum for http://supernova.ws
*/
require_once('includes/init.php');
$user = sn_autologin(!$allow_anonymous);
if($config->game_disable)
{
$disable_reason = sys_bbcodeParse($config->game_disable_reason);
if ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
{
message($disable_reason, $config->game_name);
ob_end_flush();
die();
}
else
{
print("<div align=center style='font-size: 24; font-weight: bold; color:red;'>{$disable_reason}</div><br>");
}
}
$sys_user_logged_in = $user && is_array($user) && isset($user['id']) && $user['id'];
if(
!($allow_anonymous || $sys_user_logged_in) ||
(defined('IN_ADMIN') && IN_ADMIN && $user['authlevel'] < 1)
)
{
setcookie($config->COOKIE_NAME, '', time() - 3600*25);
header('Location: ' . (IN_ADMIN == true ? '../' : '') .'login.php');
ob_end_flush();
die();
}
lng_include('system');
lng_include('tech');
if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0)
{
echo "<a href=\"badqrys.txt\" target=\"_NEW\"><font color=\"red\">{$lang['ov_hack_alert']}</font</a>";
}
if (defined('IN_ADMIN') && IN_ADMIN)
{
$UserSkin = $user['dpath'];
$local = stristr ( $UserSkin, "http:");
if ($local === false)
{
if (!$user['dpath'])
{
$dpath = "../". DEFAULT_SKINPATH ;
}
else
{
$dpath = "../". $user["dpath"];
}
}
else
{
$dpath = $UserSkin;
}
lng_include('admin');
}
elseif($sys_user_logged_in)
{
$dpath = $user["dpath"] ? $user["dpath"] : DEFAULT_SKINPATH;
flt_flying_fleet_handler($config, $skip_fleet_update);
$planet_id = SetSelectedPlanet($user);
doquery('START TRANSACTION;');
$global_data = sys_o_get_updated($user, $planet_id, $time_now);
if(!$global_data['planet'])
{
doquery("UPDATE {{users}} SET `current_planet` = '{$user['id_planet']}' WHERE `id` = '{$user['id']}' LIMIT 1;");
$global_data = sys_o_get_updated($user, $user['id_planet'], $time_now);
}
doquery('COMMIT;');
if(!$global_data)
{
$debug->error("User ID {$user['id']} has no current planet and no homeworld", 'User record error', 502);
}
$planetrow = $global_data['planet'];
if(!($planetrow && isset($planetrow['id']) && $planetrow['id']))
{
header('Location: login.php');
ob_end_flush();
die();
}
$que = $global_data['que'];
CheckPlanetUsedFields($planetrow);
if(!$allow_anonymous)
{
sys_user_vacation($user);
}
}
?>