Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 889
0 Users 11 Guests Online
Forum Index » PHP + MySQL » Help on my login
Posted on Wednesday 12th November 2 at 08:42 PM
peza
templates/default/images/noavatar.png's Avatar
Newbie
I'm not getting any type of errors in this code but i have a problem in which it will only check if the feilds are empty anything after that say eg. User not found, will be white even when i try to login on my registered acount it also go's white, any help would be cool thanks.

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'])) {
$usernamehtmlspecialchars(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>";
?>
Posted on Wednesday 12th November 2 at 10:05 PM
jambomb
templates/default/images/noavatar.png's Avatar
Junior Member
i dont really know what you mean ??
Posted on Wednesday 12th November 2 at 10:10 PM
peza
templates/default/images/noavatar.png's Avatar
Newbie
its alright i just took the feild check out for now it seemed to be the problem