2017-02-05 11:51:02 -06:00
< ? php // globals.php :: Storage for lots of super important arrays we're probably going to need eventually.
// Config.php.
include ( " config.php " );
if ( trim ( $dbsettings [ " secretword " ]) == " " ) { die ( " Invalid setting for secretword in config.php. This setting must never be blank. " ); }
// Control row.
2017-02-05 11:57:55 -06:00
$controlrow = dorow ( doquery ( " SELECT * FROM <<control>> WHERE id='1' LIMIT 1 " ));
2017-02-05 11:51:02 -06:00
// Account row.
include ( " cookies.php " );
$acctrow = checkcookies ();
if ( $acctrow == false && substr ( $_SERVER [ " REQUEST_URI " ], - 21 ) != " users.php?do=register " ) { die ( header ( " Location: login.php?do=login " )); }
if ( $acctrow != false && $acctrow [ " characters " ] == 0 && substr ( $_SERVER [ " REQUEST_URI " ], - 20 ) != " users.php?do=charnew " ) { die ( header ( " Location: users.php?do=charnew " )); }
// User row.
2017-02-05 11:54:46 -06:00
if ( substr ( $_SERVER [ " REQUEST_URI " ], - 19 ) != " login.php?do=logout " ) {
2017-02-05 11:57:55 -06:00
$online = doquery ( " UPDATE <<users>> SET onlinetime=NOW() WHERE id=' " . $acctrow [ " activechar " ] . " ' LIMIT 1 " );
2017-02-05 11:54:46 -06:00
} else {
2017-02-05 11:57:55 -06:00
$online = doquery ( " UPDATE <<users>> SET onlinetime = DATE_SUB(onlinetime, INTERVAL 11 MINUTE) WHERE id=' " . $acctrow [ " activechar " ] . " ' LIMIT 1 " );
2017-02-05 11:54:46 -06:00
}
2017-02-05 11:57:55 -06:00
$userrow = dorow ( doquery ( " SELECT * FROM <<users>> WHERE id=' " . $acctrow [ " activechar " ] . " ' LIMIT 1 " ));
2017-02-05 11:54:46 -06:00
if ( $userrow != false ) { $userrow = array_map ( " stripslashes " , $userrow ); }
2017-02-05 11:51:02 -06:00
// World row.
2017-02-05 11:57:55 -06:00
$worldrow = dorow ( doquery ( " SELECT * FROM <<worlds>> WHERE id=' " . $userrow [ " world " ] . " ' LIMIT 1 " ));
2017-02-05 11:51:02 -06:00
// Town row.
if ( $userrow [ " currentaction " ] == " In Town " ) {
2017-02-05 11:57:55 -06:00
$townrow = dorow ( doquery ( " SELECT * FROM <<towns>> WHERE world=' " . $userrow [ " world " ] . " ' AND longitude=' " . $userrow [ " longitude " ] . " ' AND latitude=' " . $userrow [ " latitude " ] . " ' LIMIT 1 " ));
2017-02-05 11:51:02 -06:00
} else {
$townrow = false ;
}
// Spells.
2017-02-05 11:57:55 -06:00
$spells = dorow ( doquery ( " SELECT * FROM <<spells>> ORDER BY id " , " spells " ), " id " );
2017-02-05 11:51:02 -06:00
// Global fightrow.
$fightrow = array (
" playerphysdamage " => 0 ,
" playermagicdamage " => 0 ,
" playerfiredamage " => 0 ,
" playerlightdamage " => 0 ,
" monsterphysdamage " => 0 ,
" monstermagicdamage " => 0 ,
" monsterfiredamage " => 0 ,
" monsterlightdamage " => 0 ,
2017-02-05 11:58:57 -06:00
" track " => " " ,
2017-02-05 11:51:02 -06:00
" message " => " " );
?>