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.

Similar Messages

  • 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.

  • 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

  • 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

  • HT1695 How do I unlock my wifi on IPad.  My computer shows its connected by my IPad and  cells show its locked.  I couldn't get the password to work so reset the password and the new one doesn't unlock it either.  It says I can

    How do I unlock my WIFI, my computer said its connected by both my IPad and Cell phones show a lock on them.  When it ask for my password I put it in and it  says I am not allowed to join.

    iOS 6 Wifi Problems/Fixes
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting
    http://www.apple.com/support/ipad/wifi/
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • 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

  • 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

  • Forgotten password, and hadnt yet synced it with my macbook - is there any way I can retrieve my photos before i reset it.

    Changed my password on my ipad recently - now cant remember it. I hadn't yet synced my ipad with my macbook - is there any way I can retrieve my photos on my ipad before i restore it.....

    Arghhhh thought so.

  • 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

  • Question about reset password in lesson08 of David Powers (Dreamweaver CS5 with PHP)

    I'm at the page 299 that found a problem in reset password. I managed to received email of link to reset password. In the reset password form, why no checking of password length entered or password unmatch with confirmed password input ? Instead it displays error message of 'Sorry, there was an error. Make sure you used the complete URL in the email you received. The URL can be used to change your password only once. If necessary...' The error message of 'Passwords don't match' or 'Use 8-15 letters or numbers only' not processed.
    Please help !
    Thank You

    I can see the 32 characters attached to URL and also I can see the 32 characters stored in database. It actually can reset the the password if entered within the requirement of 8-15. But when I entered less than 8, it does not show the error message of 'Use 8-15 letters or numbers only'.
    I noticed that $_SESSION['nomatch'] was assigned to True after the validation of 8-15 length. Below is the code for reference.
    <?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();

  • How do I reset a password to find my wife iPhone with my iPhone?

    How do I reset a pass word to find my wife iPhone with my iPhone

    Setup Find My iPhone
    iCloud: Set up Find My iPhone

  • Dreamweaver CS5 with PHP, not getting it to work with virtual Host

    I have not got far with the book so far.  I am still on the second chapter where you set the Virtual Host but after setting up the Dreamweaver site definition and doing the test.  I get the error that page cannot be found.
    I ask if I can mail the text file of the http.conf and the httpd-vhosts.conf to anyone to see if I screwed up somewhere .  I am running on Windows 7 with the WAMP setup.

    Mr. Powers,
    I used your included file httpd-vhosts.conf.  And it did something since now I get a new set of errors.
    ( ! ) Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
    ( ! ) Fatal error: Unknown: Failed opening required  'C:/vhosts/phpcs5/lesson02/site_check.php'  (include_path='.;C:\php\pear') in Unknown on line 0
    But I checked the properties of the folders and unchecked the 'read only' permission but still gets checked again.  I am using Windows 7 64-bit.
    I checked on the web nobody says any solutions about it, they only imply that is a permissions issue.
    I apologize, I found out the chapter files were encrypted... thanks

Maybe you are looking for

  • Urxvt and copy/paste-ing.

    Howdy guys. I'm new to arch, been loving it. Enjoying configuring (and learning) about the parts i need thus far. This is a weird question though. Basically i'm using urxvt (seems popular, and so far i like it) as my terminal, but i have no idea how

  • Create Project page Customization

    Hi, I need to capture the End Customer data during the project creation screen. This cannot be added using the projects Quick Entry setup. So I am trying to customize the project creation page to capture this data. 1st option I thought: - Extend the

  • How to store the result with a time are using?

    Hi, I'm using the adobe captivate 5.5 to create the Visual Aid Project. What i want to ask in captivate 5.5 is : Q1. How to record and store the time are using in each slide. ( Record down how long need to take by user to complete one slide) Q2. How

  • FCP XML to Flint - Problems with Time Remap

    My Flint artist and I have had some problems with the XML Export and Import that we cannot figure out. The XMLs from FCP sequences that have variable speed Time Remaps applied show up on the Flint with those particular clips with the wrong in/out poi

  • My multiple speaker option stopped working when I installed my apple TV?

    My multiple speaker option stoped working when I installed my apple tv today,  can anyone help me?