homepage Welcome to WebmasterWorld Guest from 54.243.12.156
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
PHP Login called from FP
Login Code not redirecting
rodan




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

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.

if(isset($_POST['login']))
{
//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
header("Location:http://www.flaschattys.com/members.htm");

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

}
}

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved