Help!! Code is driving me NUTS!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

ariaya
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Feb 11, 2003 11:17 am

Help!! Code is driving me NUTS!

Postby ariaya » Tue Apr 08, 2003 1:16 pm

I'm hoping that someone here can help me. I've looked at this code for days now and can't find the problem. It won't compile

I keep gettting Parse error: parse error in /home/catcreat/public_html/epic/chgpwd.php on line 73 as an error message, but the file only has 72 lines in it!!

Help?

Here's the code

Code: Select all

<?
/*      Change password

*/

include("accesscontrol.php");
include ("config.inc");
include("header.inc");

if ($process==0) {      // if not to process the form

echo "
<h3>Change Password</h3>
<p><font color=orangered size=+1><TT><B>*</B></TT></font>
   indicates a required field</p>
<form method=post action=\"chgpwd.php\">
<input type=\"hidden\" name=\"process\" value=1> <!-- trigger to process the form -->
<table border=0 cellpadding=0 cellspacing=5>
    <tr>
        <td align=right>
            <p>Old Password</p>
        </td>
        <td>
            <input name=oldpw type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
    <tr>
        <td align=right>
            <p>New Password</p>
        </td>
        <td>
            <input name=newpw1 type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
    <tr>
        <td align=right>
            <p>Retype New Password</p>
        </td>
        <td>
            <input name=newpw2 type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
</table>
</form>
";

} else { // if to process the form

$sql = "SELECT password FROM $user_table WHERE userid = $usernum";
$result = mysql_query($sql) or die ( error("Error retrieving password.") );

$row = mysql_fetch_array($result);
$password = $row['password'];

if ($password <> $oldpw) {
        error ( "Old password does not match password in database.");
}
if ($newpw1 <> $newpw2) {
        error ("Mismatch in new password entries.");
}

$sql = "UPDATE $user_table SET password = \"$newpw1\" WHERE userid = $usernum";
$result = mysql_query($sql) or die ( error("Error saving new password.") );

echo "
<h3>Password saved successfully</h3>
";

include ("footer.inc"); ?>


Anything you can do to help would be appreciated!

Thanks!
Ariaya

User avatar
amp
New php-forum User
New php-forum User
Posts: 15
Joined: Tue Apr 01, 2003 3:12 am
Location: Ireland
Contact:

Postby amp » Tue Apr 08, 2003 1:40 pm

Your missing a } on line 71, try this:

Code: Select all

<?
/*      Change password

*/

include("accesscontrol.php");
include ("config.inc");
include("header.inc");

if ($process==0) {      // if not to process the form

echo "
<h3>Change Password</h3>
<p><font color=orangered size=+1><TT><B>*</B></TT></font>
   indicates a required field</p>
<form method=post action=\"chgpwd.php\">
<input type=\"hidden\" name=\"process\" value=1> <!-- trigger to process the form -->
<table border=0 cellpadding=0 cellspacing=5>
    <tr>
        <td align=right>
            <p>Old Password</p>
        </td>
        <td>
            <input name=oldpw type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
    <tr>
        <td align=right>
            <p>New Password</p>
        </td>
        <td>
            <input name=newpw1 type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
    <tr>
        <td align=right>
            <p>Retype New Password</p>
        </td>
        <td>
            <input name=newpw2 type=password maxlength=16 size=25>
            <font color=orangered size=+1><TT><B>*</B></TT></font>
        </td>
    </tr>
</table>
</form>";

} else { // if to process the form

$sql = "SELECT password FROM $user_table WHERE userid = $usernum";
$result = mysql_query($sql) or die ( error("Error retrieving password.") );

$row = mysql_fetch_array($result);
$password = $row['password'];

if ($password <> $oldpw) {
        error ( "Old password does not match password in database.");
}
if ($newpw1 <> $newpw2) {
        error ("Mismatch in new password entries.");
}

$sql = "UPDATE $user_table SET password = \"$newpw1\" WHERE userid = $usernum";
$result = mysql_query($sql) or die ( error("Error saving new password.") );

echo "
<h3>Password saved successfully</h3>
";
}
include ("footer.inc"); ?>

ariaya
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Feb 11, 2003 11:17 am

Postby ariaya » Tue Apr 08, 2003 6:20 pm

so simple!!! :oops:

Thanks!

-- Ariaya


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests