Jump to content


Photo

How Would I check If Password Input Is true Then.


  • Please log in to reply
9 replies to this topic

#1 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 21 June 2006 - 02:54 AM

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 :(.
Dont Piss me Off today

#2 gfX

gfX
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 21 June 2006 - 03:00 AM

Nevermind I think I read your question wrong.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 21 June 2006 - 03:02 AM

$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;
}
 }
  }


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 21 June 2006 - 03:03 AM

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)
Dont Piss me Off today

#5 gfX

gfX
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 21 June 2006 - 03:06 AM

<?
//secondpage.php
$password = $_POST['password'];

if($password == "whatever") {
header("Location: index.php");

} else {

header("Location: whatever.php");
}
?>

<!-- somepage.html -->
<form method="post" action="secondpage.php">
Password:<BR>
<input type="password"><BR><BR>
<input type="submit" value="Submit">
</form>


#6 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 21 June 2006 - 03:07 AM

[!--quoteo(post=386257:date=Jun 20 2006, 10:02 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 20 2006, 10:02 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
$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;
}
 }
  }

[/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.

Dont Piss me Off today

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 21 June 2006 - 03:07 AM

[!--quoteo(post=386258:date=Jun 21 2006, 03:03 AM:name=scheols)--][div class=\'quotetop\']QUOTE(scheols @ Jun 21 2006, 03:03 AM) View Post[/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]

if(!$password){

header("location: whatever.html");

}elseif ($password=="none"){

header("location: whatever.html");

 }

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 21 June 2006 - 03:08 AM

[!--quoteo(post=386259:date=Jun 20 2006, 10:06 PM:name=gfX)--][div class=\'quotetop\']QUOTE(gfX @ Jun 20 2006, 10:06 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
<?
//secondpage.php
$password = $_POST['password'];

if($password == "whatever") {
header("Location: index.php");

} else {

header("Location: whatever.php");
}
?>

<!-- somepage.html -->
<form method="post" action="secondpage.php">
Password:<BR>
<input type="password"><BR><BR>
<input type="submit" value="Submit">
</form>
[/quote]coo thanks can u break the header part and location part down for me :D

Dont Piss me Off today

#9 gfX

gfX
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 21 June 2006 - 03:11 AM

If the password they entered is whatever then they will be redirected to index.php. if anything different, they will be redirected to whatever.php

Change to fit your needs.

#10 Guest_edwinsweep_*

Guest_edwinsweep_*
  • Guests

Posted 21 June 2006 - 11:24 AM

<?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';
}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users