Jump to content

Problems with login script.


xyn

Recommended Posts

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 to
check if the user is banned, or activated their account i get this
error:

"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>
<?PHP
include("../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>
<?PHP
include("../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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.