Posted on Wednesday 12th November 2008 at 08:42 PM
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
<?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>"; ?>