N0L1m1t5 Posted August 1, 2011 Share Posted August 1, 2011 If a user enters either the wrong username or password, what would the code be to have "Invalid name or password" pop up on the same page? Link to comment https://forums.phpfreaks.com/topic/243521-how-to-make-a-simple-invalid-name-or-password/ Share on other sites More sharing options...
WebStyles Posted August 1, 2011 Share Posted August 1, 2011 popup? like in javascript popups? echo '<script>alert("Invalid Username or Password");</script>'; ? ? ? Link to comment https://forums.phpfreaks.com/topic/243521-how-to-make-a-simple-invalid-name-or-password/#findComment-1250435 Share on other sites More sharing options...
manix Posted August 1, 2011 Share Posted August 1, 2011 if you want a nice styled popup I recommend using jquery and ajax Link to comment https://forums.phpfreaks.com/topic/243521-how-to-make-a-simple-invalid-name-or-password/#findComment-1250438 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 I'm taking a big GUESS <?php $check = mysql_query("select*from database where username = '$username' AND password = '$password'") or die(mysql_error()); while($confirm = mysql_fetch_array($check)) { if($username != $confirm['username'] && $password != $confirm['password']) { echo "wow you don't even know your own username and password? go hurt yourself!!!"; } else { header("Location: welcome.php")// redirect after successful longin } } ?> the $username is the variable assigned username input by user the $password is the vaiable assigned to password input by user Link to comment https://forums.phpfreaks.com/topic/243521-how-to-make-a-simple-invalid-name-or-password/#findComment-1250442 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.