|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Password
hello,
Very simple one.What I'm trying to do is...I'm writing a script to change the user password. How??? 1.The user enters his old password. 2.Enter the new password and re-enter it. 3.IF the old password is same as in the table and the new password entered twice is same, the password is updated. Fine, I've written the script and it is working fine. The problem is, i also want to display the error messages like: 1) If the old password entered is wrong or the new password which is entered twice are not same, there should be a message displayed. I'm able to display the message when the password which is entered twice is not same, it displays me the message. I ALSO WANT TO DISPLAY IF MY OLD PASSWORD IS WRONG. How can i check for that. ps:my old password is in encrypted form.ie,i used md5. This is the script for your reference, absolutely no errors. Code:
<?
include "../dbconnection.ini";
if (isset($submit) && isset($oldpassword))
{
if ($newpassword <> $newpassword2)
{
echo "New passwords do not match. Please re-enter passwords!";
exit;
}
else
{
$sql="update TBL_USER set USER_PASSWORD= '".md5($newpassword)."' where USER_NAME ='admin' AND USER_PASSWORD= '".md5($oldpassword)."'";
$result=ibase_query($connection,$sql);
if (!$result)
{
echo "Error executing the update statement. <br/>Interbase Reported:".ibase_errmsg()." <br/>".
"SQL=$sql<br />n";
}
else
{
echo "Password successfully changed!";
}
}
}
else
{
echo"<link rel="stylesheet" type="text/css" href="../formate.css">";
echo"<form action="$PHP_SELF" method="POST">n";
echo"<h4>Change administrator password</h4>";
echo"<table border="0" width="364" height="1">
<tr>
<td width="185" height="17">Old password</font></td>
<td width="163" height="17">
<p><input type="password" name="oldpassword"></p></td>
</tr>
<tr>
<td width="185" height="17">New password</font></td>
<td width="163" height="17">
<p><input type="password" name="newpassword"></p>
</td>
</tr>
<tr>
<td width="185" height="1">Repeat new password</font></td>
<td width="163" height="1"><input type="password" name="newpassword2"></td>
</tr>
</table>
";
echo"<input type="submit" value="submit" name="submit">";
echo"</form></body></html>";
}
?>
|
|
#2
|
|||
|
|||
|
RE: Password
|
|
#3
|
|||
|
|||
|
RE: Password
hello Matt,
Thanks for your tip.BUt, it does'nt display me any errors now.I entered the old password wrong,the new password also wrong.Now, when i submit, i just dont get any error messages.could you pls tell me why??? Thanks once again. Here is the code. Code:
<?
include "../dbconnection.ini";
if (isset($submit) && isset($oldpassword))
{
if ($newpassword <> $newpassword2)
{
echo "New passwords do not match. Please re-enter passwords!";
exit;
}
$sql="SELECT * FROM TBL_USER WHERE USER_NAME ='admin' AND USER_PASSWORD= '".md5($oldpassword)."'";
$result=ibase_query($connection,$sql);
if(ibase_num_fields($result) == 0)
{
echo "Old password is incorrect!";
exit;
}
else
{
$sql="update TBL_USER set USER_PASSWORD='".md5($newpassword)."' where USER_NAME ='admin' AND USER_PASSWORD='".md5($oldpassword)."'";
$result=ibase_query($connection,$sql);
if (!$result)
{
echo "Error executing the update statement. <br />Interbase Reported:".ibase_errmsg()." <br/>".
"SQL=$sql<br />n";
}
else
{
echo "Password successfully changed!";
}
}
}
else
{
echo"<link rel="stylesheet" type="text/css" href="../formate.css">";
echo"<form action="$PHP_SELF" method="POST">n";
echo"<h4>Change administrator password</h4>";
echo"<table border="0" width="364" height="1">
<tr>
<td width="185" height="17">Old password</font></td>
<td width="163" height="17">
<p><input type="password" name="oldpassword"></p>
</td>
</tr>
<tr>
<td width="185" height="17">New password</font></td>
<td width="163" height="17">
<p><input type="password" name="newpassword"></p>
</td>
</tr>
<tr>
<td width="185" height="1">Repeat new password</font></td>
<td width="163" height="1"><input type="password" name="newpassword2"></td>
</tr>
</table>
";
echo"<input type="image" src="../images/sign_save.gif" value="submit" name="submit">";
echo"</form></body></html>";
}
?>
|
|
#4
|
|||
|
|||
|
RE: Password
Hmm..that's strange. Something should be printed...try putting:
error_reporting (E_ALL); at the top of your script. Maybe some errors are being suppressed? |
|
#5
|
|||
|
|||
|
RE: Password
yep, that sounds really weird.I dont get any errors displayed still.Is my code is in order??
Thanks any way Matt. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Password |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|