PHP Code
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
<?php
session_start();
include "inc/db_connect.php";
echo "<title>OnlineGamerBase</title>";
echo "<link rel='stylesheet' href='stylesheet.css' type='text/css'/>";
echo "<center>";
if($logged[id]) {
print "$logged[username], you are being redirected...";
echo "<meta http-equiv='Refresh' content='2; URL=index2.php'/>";
}else
if(isset($_GET['login'])) {
if((!$_POST[username]) || (!$_POST[password])) {
print "ERROR: A feild was left blank please go <a href='index.php'>back</a> and try again.";
}
}else
if(isset($_GET['login'])) {
$username= htmlspecialchars(addslashes($_POST[username]));
$password = sha1(md5(md5(sha1(md5(sha1(sha1(md5($_POST[password]))))))));
$uinfo = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
$checkuser = mysql_num_rows($uinfo);
if($checkuser == '0')
{
print "Username not found"; ;
}else{
$udata = mysql_fetch_array($uinfo);
if($udata[active] == 0) {
print "Error: This account has not been verified, go <a href='index.php'>back</a>.";
}
else
if($udata[password] == $password) {
$query = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'") or die(mysql_error());
$user = mysql_fetch_array($query);
$_SESSION['id'] = "$user[id]";
$_SESSION['password'] = "$user[password]";
print "You are now logged in, Please wait. . .";
echo "<meta http-equiv='Refresh' content='2; URL=index2.php'/>";
}
else{
print "ERROR: Incorrect username or password! Go <a href='index.php'>back</a>.";
}
}
}else{
echo "
<br>
<br>
<u>Login</u>
<form action='index.php?login' method='post'>
Username:
<input name='username' type='text' maxlength='15' />
Password:
<input name='password' type='password' maxlength='15' />
<input name='submit' type='submit' value='Submit' />
</form>
<br>";
}
echo "<center>";
?>