Reset forgotten password glitch

Working through the Powers' latest book. Everything seemed to be working fine in local testing environment recently. When I uploaded the files tonight to the remote server and did a test of the forgotten password feature, I'm getting a message at the top of the Request Received screen (p. 293) that says "Connection refused" and not seeing the reset email come in. The request_reset.php code is below:
isValid($_POST['email'])) {        $errors = TRUE;      }      if (!$errors) {        $sql = $dbRead->quoteInto('SELECT user_id, first_name, last_name, email FROM users WHERE email = ?', $_POST['email']);        $result = $dbRead->fetchRow($sql);        if (!$result) {           $errors = TRUE;        } else {         // update database and send mail           $token = md5(uniqid(mt_rand(), TRUE));           $data = array('token' => $token);           $where = $dbWrite->quoteInto('email = ?', $_POST['email']);           $dbWrite->update('users', $data, "user_id = {$result['user_id']}");             }        $mail = new Zend_Mail('UTF-8');        $mail->addTo($result['email'], "{$result['first_name']} {$result['last_name']}");        $mail->setSubject('Instructions for resetting your password');        $mail->setFrom('[email protected]', 'Wild Felid Association');        $link = "http://www.conmolbry.com/WFRMA/reset.php?id={$result['user_id']}&token=$token";        $message = "Use the following link to reset your password. This link can be used once only. $link";        $mail->setBodyText($message, 'UTF-8');        $mail->send();      }   } catch (Exception $e) {      echo $e->getMessage();   } }Peter

David thank you the first approach did not work but the second one did. At least I got the email with the token link. However, when I click on the link it takes me to an error page that says:
Not Found
The requested URL /WFRMA/reset.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
The reset.php file is sitting right there in the root directory. This is the reset_password.php code if it means anything in resolving this further hiccup:
<?php
session_start();
$errors = array();
$success = FALSE;
$_SESSION['nomatch'] = TRUE;
require_once('library.php');
try {
  if (isset($_GET['id']) && isset($_GET['token'])) {
     $id = $dbRead->quote($_GET['id']);
     $token = $dbRead->quote($_GET['token']);
     $sql = "SELECT user_id FROM users WHERE user_id = $id AND token = $token";
     $result = $dbRead->fetchRow($sql);
     if ($result) {
      $_SESSION['user_id'] = $_GET['id'];
       $_SESSION['token'] = $_GET['token'];
       $_SESSION['nomatch'] = FALSE;
  if (isset($_POST['reset'])) {
     // password reset code goes here
     $val = new Zend_Validate();
     $val->addValidator(new Zend_Validate_StringLength(8,15));
     $val->addValidator(new Zend_Validate_Alnum());
     if (!$val->isValid($_POST['password'])) {
       $errors['password'] = 'Use 8-15 letters or numbers only';
     $val = new Zend_Validate_Identical($_POST['password']);
     if (!$val->isValid($_POST['conf_password'])) {
       $errors['conf_password'] = "Passwords don't match";
     if (!$errors) {
       // update the password
       $data = array('password' => sha1($_POST['password']),
                     'token'    => NULL);
       $where['user_id = ?'] = $_SESSION['user_id'];
       $where['token = ?'] = $_SESSION['token'];
       $success = $dbWrite->update('users', $data, $where);
       unset($_SESSION['user_id']);
       unset($_SESSION['token']);
       unset($_SESSION['nomatch']);
} catch (Exception $e) {
  echo $e->getMessage();
Thanks.

Similar Messages

  • Brief redux: Reset forgotten password

    Referring back to the earlier thread, my issue was resolved in terms of getting the email with token successfully sent and the password reset feature operating as it is supposed to. However, the site I'm working on I hope to transfer to an organization here shortly. I don't want my email address in the mail_connector.php file. I'm also using the mail connector file with a contact form developed  from lesson 8. So far that form is not working correctly from the remote  server. I don't understand just yet how I further modify that file as I transfer the site and the reset feature continue to work for the client and could use a bit more guidance. Thank you.

    kirkmcl21 wrote:
    How can I reset a password on my iphone that I have forgotten?
    If you cannot remember the passcode, you will need to Restore the device...
    1)  Connect to iTunes on the computer you usually Sync with and Restore...
    http://support.apple.com/kb/HT1414
    2)  If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/HT1808
    Note on Recovery Mode.
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    Once you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup
    http://support.apple.com/kb/ht1766

  • Working through Resetting Forgotten Password script in Lesson8 in CS5 with PHP

    Hi,
    I finished editing the completed scripts in lesson 8 to suit my users table in my mysql database. Originally I was getting a mysql error 1054 saying that "token" was a missing field. So I added a 100 VARCHAR "token" column in my users table. Now I am getting the following error message:
    Notice: Undefined variable: token in "path to the request_reset_unsub.php script "\request_reset_unsub.php on line 33
    An attempt was made to access a socket in a way forbidden by its access permissions.
    Also...I am still getting the
    Request Received
    An email has been sent to your registered address with instructions for resetting your password.
    message but the email that the script is supposed to send does not get sent (probably because the try block ends and goes to the catch block before the script can send the message).
    Can anyone shed some light on my dilemna?

    Also, the same thing happened in step 5 when I tried to type $dbWrite->getConnection().
    no code hints popped up at all.

  • How to reset forgotten password

    i forgot my password and disabled my ipod and inever synced my ipod with itunes how could i reset the password?

    Disabled
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • Reset Forgotten Password

    Is there an API that will allow me to reset the password of a user who forgot their password?
    I saw in article in posted ( http://technet.oracle.com:89/ubb/Forum83/HTML/000411.html ) but I am wondering if this will change the password in the OID or in the Portal Login Server.
    Thanks

    You could use a temporary LDIF file as a simple solution to do this:
    dn: [user's DN here]
    changetype: modify
    replace: userpassword
    userpassword: abc12345
    It you go about it this way, you will have to worry about protecting the security of the LDIF file (e.g., it should have OS permissions 600 and should be removed right away after running ldapmodify). A better solution would involve using JNDI code or the DBMS_LDAP package to set the password to a new value.

  • Resetting forgotten password

    resetting a forgotten password

    For screen-lock pascode:
    Connect the iOS device to your computer and restore via iTunes. Place the iOS device in Recovery Mode if necessary to allow the restore.
    If recovery mode does not work try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    For Apple ID PW:
    iTunes Store: Retrieving and changing passwords (Apple ID)

  • Need help reseting forgotten password

    its bn ages since ive used my ipod and have forgotten the password and dont know how to reset it

    Connect the iPod to its syncing computer and restore the iPod via itunes.  If iTunes asks for the unknown passcode, place the iPod in recovery mode and then restore the iPod.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore

  • Need to reset forgotten password HELP! No software

    I was given a iBook g4 by my mom
    She cannot remember her login password
    Can anyone help be reset? I don't have any software!!

    Carol:
    The easiest way to do it with the install disk. It is important to have the install disk so that you can run diagnostics and repairs on your computer. You can get the original disk that shipped with your computer by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753). Be sure to have the computer serial number or other information handy. There is a service charge of around $60. for this service.
    To access the computer without the disk follow the directions for Making the Setup Assistant reappear. This will set up a new admin account with a new password. Once you have done this you can go in and access the old admin account or delete it.
    Good luck.
    cornelius

  • Resetting Forgotten Passwords

    The password lookup facility is not working!
    I have tried several times in the last week to get my password emailed to me without success.
    As if that wasn't frustrating enough, the little box that pops up after you submit your email address, says if you don't get a response in a reasonable amount of time, click here. That takes you to the general Contact Home, and guess what, there is no way to contact OTN from there, by phone or otherwise.
    Establishing a new account every time you forget a password is not a good solution. After all, I only have two email accounts.
    Can someone in OTN please send me my userid and password for this email address?
    Thanks you,
    Richard

    http://forums.oracle.com/forums/ann.jspa?annID=14

  • How can i reset forgotten password ipod4 without losing my apps

    my son forgot his passcode for ipod touch 4 now it is locked too many attempts. is there a way to retrive or change it w/out restoring? he is afraid he will lose apps.

    Place the iPod in Recovery Mode and restore via iTunes.
    iOS: Wrong passcode results in red disabled screen
    If not successful, try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.

    I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.                                  

    None of us here, nor Apple, can help you.

  • I have forgotten my password and want to sync my iPad to a different computer so I can reset the password

    How do I reset my password when I have to sync to a different computer?

    Sync Your iOS Device with a New Computer Without Losing Data
    http://www.howtogeek.com/104298/sync-your-ios-device-with-a-new-computer-without -losing-data/
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive
    https://discussions.apple.com/docs/DOC-3141
    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    You may have to do this several times.
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just canceling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • My 7 year old has forgotten her password and now her ipod touch is locked and says connect to itunes. I have tried to connect however it will not connect because it is locked. How can I reset her password?

    My seven year old daughter got an ipod touch a few months ago from her father. She has now forgotten her password and it has been tried too many times and so the ipod has been disabled. It now say connect to itunes. I have tried to do this with the USB cable and itunes on my computer. Unfortunately it will not work as it will not connect saying the device is locked and to enter the password.
    This is not the computer that she previously connected to and she may not be able to get access to that computer. Is there a way for us to reset the password preferably without having to restore the ipod and lose everything she has on it?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                          
    If recovery mode does not work try DFU mode.                         
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings         
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • My email was deleted and I have long since forgotten the password - plus I must have typed personal information in incorrectly... I can't reset my password (email goes to deceased email account) and I have $$$$ left! What do I do?

    My email was deleted and I have long since forgotten the password - plus I must have typed personal information in incorrectly... I can't reset my password (email goes to deceased email account) and I have $$$$ left! What do I do to get access to the remaining dollars?

    You do realize that there are many, many email providers and without knowing which one you are talking about, there is no way to answer your question?
    Which then leads to this ..... Have you contacted your email provider about this? That's probably the best place to start. See what they recommend.

  • I reset my forgotten password via email on my computer, but 2 hours later new passowrd doesn't work from iPhone  What am I missing?

    I reset my forgotten password via email on my computer.  Two hours later still cannot use new password on my iPhone 5 ios 7.x.x.  Am I missing something?

    Try going to https//appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Tap edit next to the primary email account, tap Edit, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone on your device, even though it prompts you for the password for your old account ID. Then go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https//appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

Maybe you are looking for

  • Missing hard drive space and files after Genius Bar installed new Hardware

    I took my computer to genius bar.  They installed a new CD/DVD drive.  My computer wouldn't load when I got it home, so I reinstalled OSX and now I am missing tons of hard drive space and all my old files (which have been backed up).  How do I fix th

  • Touch screen stopped completely

    I have an HP Pavilion Touch Smart 14.  Two days ago on Aug 4th the touch pad stopped working with no warning. There were no updates to warrant any change as I have to approve all updates.  I have done a refresh completely swiping it back from windows

  • Cheque void if we do F-58

    If we do payment through F-58, every time one cheque is voiding automatically.  This i am able to known from FCHN.  What will be the problem.

  • Upgraded to 1.1, problem navigating in grid

    Hi Is it possible to change the result grid behaviour to be like in 1.0? I find it quite problematic to not beeing able to use the cursor keys to navigate in the grid. Every cell always gets in edit mode directly even though it's a read only grid, an

  • Message says iTunes needs to be reinstalled...

    All of a sudden, I have a message indicating I must re-install iTunes if I want to burn CDs, etc. What happened and what shouuld I do? Do I need to uninstall and then reinstall? what will that do to my music library?