?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Submitted message not displayed!
Author:??(---.in-addr.btopenworld.com)
Date:???03-06-04 05:54

I've come across a whole new problem, i'm not sure if its a bug or not but i wrote a script to change password after a user logs in. When i wrote it it worked fine. Basically what it does is if a user wants to change their password they enter their new password twice and click submit. If the passwords match and everythings OK it displays a message stating the password has been changed. As i said this was working fine but now when a user clicks submit it changes the detail but does not display the 'Password has been changed message' it just goes back to the form. I don't understand what i'm doing wrong or if its a bug. I put the script below. Can I get some help please. It was working fine before and i haven't changed anything.


require_once('includes/config.inc');

$page_title = 'Change your password';
include_once ('includes/header2.htm');

if (!isset($_SESSION['firstName'])) {
header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index3.php");
ob_end_clean();
exit();
} else {
if (isset($_POST['submit'])) {
require_once ('security/connect.php');

if (eregi ("^[[:alnum:]]{4,20}$", stripslashes(trim($_POST['password1'])))) {
if ($_POST['password1'] == $_POST['password2']) {
$p = $_POST['password1'];
} else {
$p = FALSE;
echo '

Your password did not match the confirmed password!

';
}
} else {
$p = FALSE;
echo '

Please enter a valid password!

';
}

if ($p) {

$query = "UPDATE customers SET password=PASSWORD('$p') WHERE customerID =
{$_SESSION['customerID']}";
$result = @mysql_query ($query);
if (mysql_affected_rows($result) == 1) {

echo '

Your password has been changed

';
include ('includes/footer2.htm');
exit();
} else {
$message = '

Your password could not be
changed due to a system error We apologize for the inconvenience

';
}

mysql_close();
} else {
echo '

Please correct the form below:

';
}
}

?>

Change your Password













New
Password:



Confirm New Password:














}
include ('includes/footer2.htm');

?>

?Topics Author? Date
?Submitted message not displayed!??new
Niz 03-06-04 05:54?
?Re: Submitted message not displayed!??new
bastien 03-07-04 05:43?
?Re: Submitted message not displayed!??new
Niz 03-07-04 12:49?
?Re: Submitted message not displayed!??new
bastien 03-07-04 13:22?
?Re: Submitted message not displayed!??new
Niz 03-07-04 15:53?
?Re: Submitted message not displayed!??new
bastien 03-07-04 16:37?
?Re: Submitted message not displayed!??new
Niz 03-08-04 06:49?
?Re: Submitted message not displayed!??new
bastien 03-08-04 14:46?
?Re: Submitted message not displayed!??new
Niz 03-09-04 08:52?
?Re: Submitted message not displayed!??new
bastien 03-09-04 15:27?
?Re: Submitted message not displayed!??new
Mr_Skatoo 03-09-04 20:45?
?Re: Submitted message not displayed!??new
Niz 03-10-04 05:37?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > I've come across a whole new problem, i'm not sure if its a > bug or not but i wrote a script to change password after a > user logs in. When i wrote it it worked fine. Basically what > it does is if a user wants to change their password they > enter their new password twice and click submit. If the > passwords match and everythings OK it displays a message > stating the password has been changed. As i said this was > working fine but now when a user clicks submit it changes the > detail but does not display the 'Password has been changed > message' it just goes back to the form. I don't understand > what i'm doing wrong or if its a bug. I put the script below. > Can I get some help please. It was working fine before and i > haven't changed anything. > > > require_once('includes/config.inc'); > > $page_title = 'Change your password'; > include_once ('includes/header2.htm'); > > if (!isset($_SESSION['firstName'])) { > header ("Location: http://" . $_SERVER['HTTP_HOST'] . > dirname($_SERVER['PHP_SELF']) . "/index3.php"); > ob_end_clean(); > exit(); > } else { > if (isset($_POST['submit'])) { > require_once ('security/connect.php'); > > if (eregi ("^[[:alnum:]]{4,20}$", > stripslashes(trim($_POST['password1'])))) { > if ($_POST['password1'] == $_POST['password2']) { > $p = $_POST['password1']; > } else { > $p = FALSE; > echo '

Your password did not > match the confirmed password! >

'; > } > } else { > $p = FALSE; > echo '

Please enter a valid > password!

'; > } > > if ($p) { > > $query = "UPDATE customers SET password=PASSWORD('$p') WHERE > customerID = > {$_SESSION['customerID']}"; > $result = @mysql_query ($query); > if (mysql_affected_rows($result) == 1) { > > echo '

Your password has been changed

'; > include ('includes/footer2.htm'); > exit(); > } else { > $message = '

Your password > could not be > changed due to a system error We apologize for the > inconvenience

'; > } > > mysql_close(); > } else { > echo '

Please correct the form > below:

'; > } > } > > ?> > >

Change your Password

>
method="post"> > cellspacing="0"> > > > > > > > > > >
New > Password: > size="20" maxlength="40" /> >
> Confirm New Password: > size="20" maxlength="40" /> >
> >
>

> > >

>
>
>
> > } > include ('includes/footer2.htm'); > > ?> ">??

Provided By
Phorum