Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

PHP Login called from FP

Login Code not redirecting



4:19 pm on Sep 18, 2006 (gmt 0)

10+ Year Member

I have a website built with FrontPage 2003. From the members page I have a hyperlink that opens a php login page. When I type in an invalid username and password I want to redirect back to the members page. Here is a portion of the code in my php login file.

//connect to database
if ($link = mysql_connect('localhost', '#*$!', '#*$!'))
// select the database that will be used
mysql_select_db("#*$!") or die("An error as occurred. Please contact the site administrator.");

//set post variables
$username = $_POST['loginUserID'];
$password = $_POST['loginPassword'];

// makes sure fields are completed
if(!$_POST['loginUserID'] ¦!$_POST['loginPassword'])
echo "Please enter the username and/or password";

$check = mysql_query("SELECT * FROM members WHERE username = '".$_POST['loginUserID']."'")or die(mysql_error());

//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);

while($info = mysql_fetch_array( $check ))
//gives error if the password is wrong
if ($_POST['loginPassword']!= $info['passwd'])
die('Incorrect password, please try again.');

//redirect to member home page

//create cookie
setcookie("user", $username); /* Expires in a week */



Featured Threads

Hot Threads This Week

Hot Threads This Month