Show login.php syntax highlighted
<?php
define("VALID_PAGE", 1);
require(dirname(__FILE__) . "/includes/common.php");
$validkeys = array('login', 'password', 'autologin', 'themefile');
globalize($validkeys);
if (get_magic_quotes_gpc()) {
foreach ($validkeys as $key) {
$$key = stripslashes($$key);
}
}
$error = "";
$plrtable = "{$conf['dbtblprefix']}plr";
$plrprofiletable = "{$conf['dbtblprefix']}plr_profile";
$plridstable = "{$conf['dbtblprefix']}plrids";
$uid = $conf['uniqueid'];
if (empty($themefile) or !$conf['allowthemechange']) $themefile = 'login';
// get unique player information
list($totalworldids,$totalnames,$totalplrs) = $ps->fetch_row(0,"SELECT count(distinct worldid), count(distinct name), count(*) FROM $plrtable");
if (!user_logged_on() and $_POST['submit']) {
$cmd = "SELECT plr.plrid,pp.accesslevel,pp.password,pp.worldid,pp.username,pp.name ";
$cmd .= "FROM $plrtable plr, $plrprofiletable pp WHERE pp.$uid=plr.$uid AND ";
$keys = array('worldid', 'username', 'name', 'ipaddr');
$p = array();
foreach ($keys as $key) {
// if ($key == 'name' and $totalnames != $totalplrs) continue; // skip name logins if they're not unique
$match = ($key != 'ipaddr') ? $login : sprintf("%u", ip2long($login));
$p = $ps->fetch_row(1, "$cmd pp.`$key`='" . $ps->escape($match) . "' LIMIT 1");
// print $ps->lastcmd ."<br>"; // DEBUG
// we found a match ...
if ($p['plrid'] and $p['password'] == md5($password)) {
break;
} else {
$p = array();
}
}
// If the userid was valid and their accesslevel allows at least basic USER access ....
if ($p['plrid'] and $p['accesslevel'] >= ACL_USER) {
if ($conf['disablelogin'] and $p['accesslevel'] < ACL_ADMIN) {
$error = $lang->trans("User logins have been disabled by the administrator");
} else {
$session->onlinestatus(1, $p['plrid']);
if ($autologin) $session->saveAutoLogin($p['plrid'], $password);
previouspage();
}
} elseif (!$p['plrid']) {
$error = "<b>" . $lang->trans("Authorization Failed:") . "</b><br><br>" . $lang->trans("Invalid Login or Password");
} else {
$error = "<b>" . $lang->trans("Authorization Declined:") . "</b><br><br>" . $lang->trans("Your player account will not accept logins at this time.") . "<br>" . $lang->trans("Please contact your server admin.");
}
}
// Load the theme and display it
$data = array(
'error' => $error,
'steamid' => $steamid,
'username' => $username,
'autologin' => $autologin,
'totalworldids' => $totalworldids,
'totalnames' => $totalnames,
'totalplayers' => $totalplayers,
);
$smarty->assign($data);
$smarty->parse($themefile);
$smarty->showpage();
include(DOCROOT . "includes/footer.php");
?>
See more files for this project here