forked from jamuraa/gatherling
/
login.php
77 lines (70 loc) · 2.45 KB
/
login.php
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
<?php include 'lib.php';?>
<?php $in = testLogin();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>PDCMagic.com | Gatherling | Login</title>
<?php include '../header2.ssi';?>
<?php include 'gathnav.php';?>
<div id="breadcrummer"><div class="innertube"><p class="breadcrumb"><a href="/">PDCMagic.com</a><a href="index.php">Gatherling</a>Login</p></div></div>
<div id="contentwrapper">
<div id="contentcolumn"><br>
<div class="articles">
<table width=95% align=center border=1 bordercolor=black
cellspacing=0 cellpadding=5>
<tr><td class=articles bgcolor=#B8E0FE align=center cellpadding=5>
<h1>Gatherling Login</h1></td></tr>
<tr><td bgcolor=white><br>
<?php content($in);?>
<br></td></tr>
<tr><td align=center bgcolor=#DDDDDD cellpadding=15>
<h3><?php version_tagline(); ?></h3>
</td></tr></table></div>
<br /><br /></div></div>
<?php include '../footer.ssi';?>
<?php
function content($in) {
if(!$in) {
loginForm();
}
}
function loginForm() {
if(isset($_POST['mode'])) {loginFailed();}
echo "<form action=\"login.php\" method=\"post\">\n";
echo "<table align=\"center\" style=\"border-width: 0px\" cellpadding=\"3\">\n";
echo "<tr><td><b>MTGO Username</td>\n";
echo "<td><input type=\"text\" name=\"username\" value=\"\"></td></tr>\n";
echo "<tr><td><b>Gatherling Password</td>\n";
echo "<td><input type=\"password\" name=\"password\" value=\"\">\n";
echo "</td></tr>\n";
echo "<tr><td> </td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\">\n";
echo "<input type=\"submit\" name=\"mode\" value=\"Log In\">\n";
echo "<tr><td> </td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\">\n";
echo "Please <a href=\"register.php\">Click Here</a> if you need to ";
echo "register.\n";
echo "</table>\n";
echo "</form>\n";
}
function loginFailed() {
echo "<center>Incorrect username or password. Please try again.\n";
echo "</center><br>";
}
function testLogin() {
$success = 0;
if(isset($_POST['username']) && isset($_POST['password'])) {
$auth = Player::checkPassword($_POST['username'], $_POST['password']);
if ($auth) {
session_start();
header("Cache-control: private");
$_SESSION['username'] = $_POST['username'];
header("location: player.php");
$success = 1;
}
}
return $success;
}
?>