Dragon-Scourge/login.php
Jamin Blount d529178672 Beta 4 Build 17
8.09.2006 - Build 17 (Haiku):
- Moved stylesheets into .css files.
- Added javascript tooltips for the class info when creating a new
character.
- Changed doquery() format - rewrote all calls to this function to match
the new format.
- Various changes to the structure of lib.php.
- Implemented Anman's increased attack and defense spells (Blessed
Strike & Stone Skin).
- Fixed class display in profile view.
- Began admin control panel.
- Various little bitty fixes.
- You can no longer gamble 0 gold.
- Added new level stat type: life.
- Monsters can now do excellent hits, and you can now dodge monsters.
- Removed several columns from controlrow that are no longer used.
2017-02-05 11:57:55 -06:00

51 lines
1.7 KiB
PHP

<?php // login.php :: Handles user logins and logouts.
include("lib.php");
if (isset($_GET["do"])) { $do = $_GET["do"]; } else { $do = ""; }
switch($do) {
case "logout":
logout();
break;
default:
login();
}
function login() {
if (isset($_POST["submit"])) {
// Setup.
include("config.php");
extract($_POST);
$query = doquery("SELECT * FROM <<accounts>> WHERE username='$username' LIMIT 1");
$row = dorow($query);
// Errors.
if ($row == false) { err("Invalid username. Please <a href=\"index.php\">go back</a> and try again.", false, false); }
if ($row["password"] != md5($password)) { err("Invalid password. Please <a href=\"index.php\">go back</a> and try again.", false, false); }
if ($row["verifycode"] != 1) { err("You have not yet verified your account. Please click the link found in your Accoutn Verification email before continuing. If you never received the email, please check your spam filter settings or contact the game administrator for further assistance.", false, false); }
// Finish.
$newcookie = $row["id"] . " " . $username . " " . md5($row["password"] . "--" . $dbsettings["secretword"]);
if (isset($remember)) { $expiretime = time()+31536000; $newcookie .= " 1"; } else { $expiretime = 0; $newcookie .= " 0"; }
setcookie("scourge", $newcookie, $expiretime, "/", "", 0);
die(header("Location: index.php"));
} else {
display("Log In", gettemplate("login"), false);
}
}
function logout() {
include("globals.php");
setcookie("scourge", "", (time()-3600), "/", "", 0);
die(header("Location: login.php?do=login"));
}
?>