scheols Posted June 21, 2006 Share Posted June 21, 2006 How would i check if input password is true on submit and send to a new page then if false it sends to a another page i dont know what to do :(. Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/ Share on other sites More sharing options...
gfX Posted June 21, 2006 Share Posted June 21, 2006 Nevermind I think I read your question wrong. Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47896 Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 [code]$query="SELECT * from xxxx WHERE xxx='xxx' and xxx='$xxx'";$result=mysql_query($query)or die("problam");while($row=mysql_fetch_array($result)) {if(mysql_num_rows($result) == 1) {$xxx=$row["xxx"];$xxx=$row["xxx"];$xxx=$row["xxxx"];if($row["xxx"]=="xxx"){header("location: xxxxxx.php?id=$id");exit;} } }[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47898 Share on other sites More sharing options...
scheols Posted June 21, 2006 Author Share Posted June 21, 2006 Naw What i saying is the password input checks to see if password is correct and if the password is correct sends you to a new page and if password is not corrent it sends you to another page saying Authorized blah blah blah (just a custom HTML page ill make and upload to my FTP) Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47899 Share on other sites More sharing options...
gfX Posted June 21, 2006 Share Posted June 21, 2006 [code]<?//secondpage.php$password = $_POST['password'];if($password == "whatever") {header("Location: index.php");} else {header("Location: whatever.php");}?>[/code][code]<!-- somepage.html --><form method="post" action="secondpage.php">Password:<BR><input type="password"><BR><BR><input type="submit" value="Submit"></form>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47900 Share on other sites More sharing options...
scheols Posted June 21, 2006 Author Share Posted June 21, 2006 [!--quoteo(post=386257:date=Jun 20 2006, 10:02 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 20 2006, 10:02 PM) [snapback]386257[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]$query="SELECT * from xxxx WHERE xxx='xxx' and xxx='$xxx'";$result=mysql_query($query)or die("problam");while($row=mysql_fetch_array($result)) {if(mysql_num_rows($result) == 1) {$xxx=$row["xxx"];$xxx=$row["xxx"];$xxx=$row["xxxx"];if($row["xxx"]=="xxx"){header("location: xxxxxx.php?id=$id");exit;} } }[/code][/quote]Had nothing to do with Mysql database it is based off a HTML FORMsay i have a password input and a name input i want it to check for password i can check for name later then yuo click submit when u click submit php starts and toggles the FOrm checking for the input password and if password is correct sends you from that page to new page else it sends you to another page. Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47901 Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 [!--quoteo(post=386258:date=Jun 21 2006, 03:03 AM:name=scheols)--][div class=\'quotetop\']QUOTE(scheols @ Jun 21 2006, 03:03 AM) [snapback]386258[/snapback][/div][div class=\'quotemain\'][!--quotec--]Naw What i saying is the password input checks to see if password is correct and if the password is correct sends you to a new page and if password is not corrent it sends you to another page saying Authorized blah blah blah (just a custom HTML page ill make and upload to my FTP)[/quote][code]if(!$password){header("location: whatever.html");}elseif ($password=="none"){header("location: whatever.html"); } [/code] Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47902 Share on other sites More sharing options...
scheols Posted June 21, 2006 Author Share Posted June 21, 2006 [!--quoteo(post=386259:date=Jun 20 2006, 10:06 PM:name=gfX)--][div class=\'quotetop\']QUOTE(gfX @ Jun 20 2006, 10:06 PM) [snapback]386259[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]<?//secondpage.php$password = $_POST['password'];if($password == "whatever") {header("Location: index.php");} else {header("Location: whatever.php");}?>[/code][code]<!-- somepage.html --><form method="post" action="secondpage.php">Password:<BR><input type="password"><BR><BR><input type="submit" value="Submit"></form>[/code][/quote]coo thanks can u break the header part and location part down for me :D Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47903 Share on other sites More sharing options...
gfX Posted June 21, 2006 Share Posted June 21, 2006 If the password they entered is [b]whatever[/b] then they will be redirected to index.php. if anything different, they will be redirected to whatever.phpChange to fit your needs. Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47905 Share on other sites More sharing options...
Guest edwinsweep Posted June 21, 2006 Share Posted June 21, 2006 [code]<?phpif (($_REQUEST['loginnaam']) or ($_REQUEST['pass'])){$_SESSION['pass'] = $_REQUEST['pass'];$_SESSION['loginnaam'] = $_REQUEST['loginnaam'];include ('config.inc.php');require("dbcon.inc.php");$pass = $_SESSION['pass'];$loginnaam = $_SESSION['loginnaam'];//$_SESSION['location'] = 'forum.php?'. SID .'';// Retrieve all the data from the "members" table$result = mysql_query("SELECT * FROM members WHERE password = '$pass' AND loginnaam = '$loginnaam'") or die(mysql_error()); // store the record of the "members" table into $row$row = mysql_fetch_array( $result );// Print out the contents of the entry// check if the password and loginnaam that has been typed in the form is the same as the one in the DataBaseif (($pass == $row['password']) AND ($loginnaam == $row['loginnaam'])){$status = 'logged';if (isset($row['maxnrreplys'])){$_SESSION['maxnrreplys'] = $row['maxnrreplys'];}else{$_SESSION['maxnrreplys'] = '10';}$_SESSION['usertype'] = $row['usertype'];$_SESSION['ID'] = $row['ID'];$_SESSION['location'] = 'forum/index.php?';//$_SESSION['location'] = 'news.php?';$_SESSION['status'] = 'LOGGED';$_SESSION['loginnaam'] = $loginnaam;}else{//$_SESSION['status'] = 'unlogged'; print ("<center><h1><font color=blue>Wrong Data Entered, Try Again</font></h1></center>");//include ('login.html');die ();}}else{//$_SESSION['status'] = 'UNLOGGED';//echo 'geen aanvraag';}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12506-how-would-i-check-if-password-input-is-true-then/#findComment-47983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.