homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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

10+ Year Member

Msg#: 3087539 posted 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.

//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 */



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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved