Jump to content

$_get result not working??


shadiadiph

Recommended Posts

I have a change password page i have been playing around with it works updating the password if if the original password was entered and returns to the page and if the wrong password goes back to the page but it isn't displaying the results sorry i am new to all this any help will be appreciated thanks.

 

<? 
session_start();
error_reporting(7);
require("../global/admin_functions.php");
$sid = $_SESSION['LOGINID'];

if($sid!="")

{

            
	$accountid     		=     ($_POST["accountid"]);	
	$password     		=     ($_POST["password"]);
	$newpassword      	=	($_POST["newpassword"]);

$sql 	= "select password from tbluserdetails where intAccountID=$sid";
$temps  = $DB_site->query($sql);
if($row=$DB_site->fetch_array($temps))
{

	if ($password == $row[password])
	{

	$insertsql = "update tbluserdetails set password='$newpassword', dtupdated='now()' where intAccountID='$accountid'";

	$DB_site->query($insertsql);
	header("Location:updatepw.php?accountid='$sid'&result='1'");
	exit;
}

else {

	header("Location:updatepw.php?accountid='$sid'&result='2'");
            exit;
}
}
}
?>

 

here is the table i have put on the next page to get the result for example the url header when it jumps back to the page reads http://asiapacificsolutions.net/hmt/user/myaccount/updatepw.php?accountid='2'&result='2'

 

<table>
<?
$result = $_GET['result']; 
if($result=="1")
{
?>
<tr> 
<td><font color="#FF0000">Old 
Password Mismatched</font> 
</td>
</tr>
<?
}
elseif($result=="2")
{
?>
<tr> 
<td><font color="#007bcb">Password 
Successfully Updated</font>  
</td>
</tr>
<? 
}
?>
</table>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/137545-_get-result-not-working/
Share on other sites

In your first page you check if prev password matches and if it does, it updates table to new password, but then sends result as 1, which displays the password mismatched message.  You send the password updated successfully message only if $sid == ""

Archived

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

×
×
  • Create New...

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.