php Change Password Function

Posted on 2012-04-03
Last Modified: 2012-08-14
I am trying to figure out to make a password change form and function from some sample code so I can use it for another project.  The sample has a form with an authentication function and a link with a registration form and function.  

I figure I should be able to copy the "addUser.php" code, and modify it to update the user's password.  I think I've got it pretty close, but I can't even get the form to open.  It keeps bombing with a parse error on the line:
  <form action="<? $_SERVER['PHP_SELF'] ?>" name="myForm" method="post">

Can someone tell me what I've got wrong here??

Thanks, Lynn
Question by:Lambel
  • 2
  • 2

Expert Comment

ID: 37804085
Take the offending line of code, and change it to this:
<form action="<?php echo $_SERVER['PHP_SELF'];?>" name="myForm" method="post">

or simply this:
<form action="" name="myForm" method="post">

Author Comment

ID: 37804109
Thanks for the response.  I tried both, but still get the error:

Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/students/ics325s12/ics325s1210/public_html/lab22/changePass.php on line 28

Accepted Solution

designatedinitializer earned 500 total points
ID: 37804158
You're missing a '   in line 8 of changePass.php
It is:

             $newPswd = $_POST['newPassword];

But should be:

             $newPswd = $_POST['newPassword'];

Author Comment

ID: 37804433
Thanks very much for your help!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now