Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login Script Error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I was wondering if anyone knew what's wrong with the script at the bottom of the page.

The problem is I have two tables with the following structure:-

bands_tbl:
-id
-user_id

members_tbl:
-uid
-username
-password

and the values $user_name, $user_password and $band_id are sent from a form to the coding below but it doesn't seem to work even when the correct information is given. The variable $band_id is the $id value from the bands_tbl and the other two variables explain themselves.

If anyone could help i'd be greatful. Thanx

<?
require(&quot;../config.inc.php&quot;);
$db = mysql_connect($host,$login,$pass);
mysql_select_db($base,$db);

$query = mysql_query(&quot;SELECT user_id FROM bands_tbl WHERE id = '$band_id'&quot;);
while ($record = mysql_fetch_object($query))
{
$user_id = $record->user_id;
}

$query2 = mysql_query(&quot;SELECT * FROM members_tbl WHERE uid = '$user_id' AND username = '$user_name' AND password = '$user_password'&quot;);
$results = mysql_num_rows($query2);

if ($results == '1')
{
session_start();
session_register('band_id');
session_register('user_name');
header('LOCATION: index.php');
}
else
{
echo '<font face=&quot;Verdana&quot; size=&quot;2&quot;>Wrong Username or Password</font>';
include('login.php');
exit;
}

mysql_close($db);
?>
 
What unexpected thing is your script doing? ______________________________________________________________________
TANSTAAFL!
 
when I try input the correct information it returns to the login.php saying that i've inputted the wrong username and password when i haven't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top