Jump to content

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 == ""

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.