xyn Posted July 31, 2006 Share Posted July 31, 2006 Hey Guys,I've used the same method for my login script before,Yet all of a sudden it is deciding not to work. The problem is...I have a login script and it works, but when I add the script tocheck if the user is banned, or activated their account i get thiserror:"please enter a username" which is one of my errors at the top of the script.My codes together are; (below are the two separate scripts):[code]<?PHP session_start(); ?><html><head><meta http-equiv="Content-Language" content="en-gb"><meta name="keywords" content="Eumod, Eurpean modified cars, modded, mod, customized"><meta name="description" content="Eumod is a discussion wbesite and fitting company. we're proud of our services and expanding."><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><link rel="stylesheet" type="text/css" href="style.css"><title>EZone Logging in</title></head><body><?PHPinclude("../db/db.php"); $user = $_POST['user']; $pass = $_POST['pass']; if ($user == NULL){ die('<p class="text">You must enter in a username.</p>');} if ($pass == NULL){ die('<p class="text">You must enter in a password.</p>');} //AUTHORIZE BAN $sql = mysql_query("SELECT adm_ban,pri_active FROM accounts WHERE usr_user='".strtolower($_POST['user'])."' AND usr_pass='".md5($_POST['pass'])."'"); while( $data = mysql_fetch_array($sql, MYSQL_NUM)) { $ban = $data[0]; $act = $data[1]; if($ban == "y") { echo '<meta http-equiv="REFRESH" content="0;ULR=../index.php?category=ezone&page=suspended">'; exit; } if($act != y) { echo '<meta http-equiv="REFRESH" content="0;ULR=../index.php?category=ezone&page=inactive">'; exit; } }$user_query = mysql_query("SELECT * FROM accounts WHERE usr_user='".strtolower($user)."' AND usr_pass='".md5($pass)."'"); $num_users = mysql_num_rows( $user_query ); if (!$num_users){ die('<p class="text">Wrong combination or user does not exist!<BR><a href="javascript:history.back(1)">Go Back</a></p>'); } else { while($user = mysql_fetch_assoc( $user_query)){ $_SESSION['EumodUK'] = true; $_SESSION['user'] = $user; echo '<meta http-equiv="refresh" content="0;URL=../index.php">'; } }?></body></html>[/code]My code is:[code]<?PHP session_start(); ?><html><head><meta http-equiv="Content-Language" content="en-gb"><meta name="keywords" content="Eumod, Eurpean modified cars, modded, mod, customized"><meta name="description" content="Eumod is a discussion wbesite and fitting company. we're proud of our services and expanding."><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><link rel="stylesheet" type="text/css" href="style.css"><title>EZone Logging in</title></head><body><?PHPinclude("../db/db.php"); $user = $_POST['user']; $pass = $_POST['pass']; if ($user == NULL){ die('<p class="text">You must enter in a username.</p>');} if ($pass == NULL){ die('<p class="text">You must enter in a password.</p>');}$user_query = mysql_query("SELECT * FROM accounts WHERE usr_user='".strtolower($user)."' AND usr_pass='".md5($pass)."'"); $num_users = mysql_num_rows( $user_query ); if (!$num_users){ die('<p class="text">Wrong combination or user does not exist!<BR><a href="javascript:history.back(1)">Go Back</a></p>'); } else { while($user = mysql_fetch_assoc( $user_query)){ $_SESSION['EumodUK'] = true; $_SESSION['user'] = $user; echo '<meta http-equiv="refresh" content="0;URL=../index.php">'; } }?></body></html>[/code]My ban code is:[code]//AUTHORIZE BAN $sql = mysql_query("SELECT adm_ban,pri_active FROM accounts WHERE usr_user='".strtolower($_POST['user'])."' AND usr_pass='".md5($_POST['pass'])."'"); while( $data = mysql_fetch_array($sql, MYSQL_NUM)) { $ban = $data[0]; $act = $data[1]; if($ban == "y") { echo '<meta http-equiv="REFRESH" content="0;ULR=../index.php?category=ezone&page=suspended">'; exit; } if($act != y) { echo '<meta http-equiv="REFRESH" content="0;ULR=../index.php?category=ezone&page=inactive">'; exit; } }[/code] Link to comment https://forums.phpfreaks.com/topic/16096-problems-with-login-script/ Share on other sites More sharing options...
Ifa Posted July 31, 2006 Share Posted July 31, 2006 Well, the $_POST['user'] information is lost with the refresh... Link to comment https://forums.phpfreaks.com/topic/16096-problems-with-login-script/#findComment-66306 Share on other sites More sharing options...
xyn Posted July 31, 2006 Author Share Posted July 31, 2006 what do you mean? :/ What refresh Link to comment https://forums.phpfreaks.com/topic/16096-problems-with-login-script/#findComment-66308 Share on other sites More sharing options...
xyn Posted July 31, 2006 Author Share Posted July 31, 2006 when i put the code under "ban" in that login script it says unknown user.when it's removed it works perfectly.But I don't see how considering there is NOT a refresh script unless the user:- is banned,- Inactive or logged in successfully :/ Link to comment https://forums.phpfreaks.com/topic/16096-problems-with-login-script/#findComment-66309 Share on other sites More sharing options...
Ifa Posted July 31, 2006 Share Posted July 31, 2006 shoud the if($act != y) be if($act != "y") ? Link to comment https://forums.phpfreaks.com/topic/16096-problems-with-login-script/#findComment-66313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.