Thread: login script
View Single Post
Old 01-16-2003, 06:29 PM   #8 (permalink)
trevor
Code Monkey
 
Join Date: Jan 2003
Location: Canada
Posts: 91
trevor is on a distinguished road
ok its not quit working. It takes me to failed.php EVERYTIME. I thought it was working fine last night because I had no users in the database, so it was suppost to take me to FAILED.PHP

in my index page i have the username and password going to Array[username] and Array[password]

PHP Code:
<?
include("connect.php");

$password=$Array[password];
$username=$Array[username];

// query db for a row that matches the user/pass entered
$result=mysql_query("select * from users where username='$username' and password='$password'");

// find the number of results found with that query
$num=mysql_numrows($result);

// send to failed.php if 0 results have been found
if($num 1){
  
header("location: failed.php");
} else {
  
header("location: main.php");
}
?>
thanks,

Trevor
trevor is offline   Reply With Quote