Jump to content

Archived

This topic is now archived and is closed to further replies.

scheols

How Would I check If Password Input Is true Then.

Recommended Posts

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 :(.

Share this post


Link to post
Share on other sites
Nevermind I think I read your question wrong.

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
Share on other sites
[!--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 FORM

say 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.

Share this post


Link to post
Share on other sites
[!--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]

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites
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.php

Change to fit your needs.

Share this post


Link to post
Share on other sites
Guest edwinsweep
[code]<?php

if (($_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 DataBase
if (($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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.