Jump to content
Larry Ullman's Book Forums

itisgregory

Members
  • Content Count

    11
  • Joined

  • Last visited

  • Days Won

    1

itisgregory last won the day on April 3 2011

itisgregory had the most liked content!

Community Reputation

2 Neutral

About itisgregory

  • Rank
    Newbie
  1. Larry, Thank you for publishing your newsletters. I enjoyed your story in newsletter #39 about your story of how you got started in the business. I also like that you actually give away free books - did not know that. Since I am blessed with good job in the Construction industry I can purchase your books from Amazon. Those who are on a limited budget and struggle pay check to pay check can greatly benefit from your generosity. Those that can easily afford to should not ask for a free book. I have a BS degree in Construction Management and Structural Engineer. I am a Project Manager for a medium size nationwide private apartment developer and have worked in this industry for 20 years in one capacity or another. I am learning PHP/MySQL because I have some practical and useful ideas for web based applications that would greatly add efficiency and organization to this industry. The Construction industry as a whole is the largest single contributor to the GDP yet the most immature in its use of IT technologies. There is so much opportunity for practical and useful wed based/software applications that will increase productivity, provide better quality and reduce project durations in specific pre-construciton activities. Sincerely, Gregory Scarcell
  2. I have downloaded it and will start using it soon. The tool bar icons look useful. I see that many people have downloaded it. If it proves useful and productive for my PHP/MySQL development then I will donate to the developer. Thanks for the suggestion.
  3. I want everyone here to know that Larry made the recommendation to use Firefox web browser AND the Firebug add-on in his book PHP6/MySQL5. These were great and very useful recommendations that I have been using to help me debug AND better understand how HTML, CSS, PHP code works within a web browser. I was apprehensive at first because there are so many "unproductive" add-ons/plug-ins. Give these a try. You won't be disappointed. Thanks Larry,
  4. Stuart, I believe you are correct. My script works perfectly following Larry's example. I am a beginner struggling through all of this... THANKS TO EVERYONE WHO POSTED!
  5. Your comment may be correct however I was following Larry's script in every detail. My script now works perfectly. Gregory
  6. Paul, Your advice below worked perfectly both with the misspelling AND altering me to the error suppression. I deleted the "@" symbol and am now able to see error messages. My script now works! THANKS!!
  7. PHP 5.3 MySQL 5.5 <?php # Script 8.7 - password.php //This page lets a user change their password $page_title = 'Change Your Password'; include ('includes/header.html'); //Check if the form has been submitted if(isset ($_POST['submitted'])) { //Determine if a variable is set and not NULL //Returns TRUE if $_POST['submitted'] exists require_once ('../mysqli_connect.php'); //Connect to the db $errors = array(); //Intitialize an error array. An array is an ordered map //that associates values to keys //Check for an email address if(empty ($_POST['email'])) { $errors[] = 'You forgot to enter your email address.'; } else { $e = mysqli_real_escape_string($dbc, trim($_POST['email'])); } //Check for the current password if(empty ($_POST['pass'])) { $errors[] = 'You forgot to enter your current password.'; } else { $p = mysqli_real_escape_string($dbc, trim($_POST['pass'])); } //Check for a new password and match against the confirmed password if(!empty ($_POST['pass1'])) { if($_POST['pass1'] != $_POST['pass2']) { $errors[] = 'Your new password did not match the confirmed password.'; } else { $np = mysqli_real_escape_string($dbc, trim($_POST['pass1'])); } } else { $errors[] = 'You forgot to enter your new password.'; } if(empty($errors)) { //If everythings OK. Returns FALSE if $errors has a non-empty //and non-zero value //Check that they've entered the right email address/password combination $q = "SELECT user_id FROM users WHERE (email='$e' AND pass=SHA1('$p'))"; $r = @mysqli_query($dbc, $q); $num = @mysqli_num_rows($r); if($num == 1) { //Match was made //Get the user_id $row = mysqli_fetch_array($r, MYSQLI_NUM); //Make the update query $q = "UPDATE users SET pass=SHA1('$np') WHERE user_id=$row[0]"; $r = @maysqli_query($dbc, $q); if(mysqli_affected_rows ($dbc) == 1) { //If it ran OK //Print a message echo '<h1>Thank you!</h> <p>Your password has been updated. In Chapter 11 you will actually be able to log in!</p><p><br /></p>'; } else { //If it did not run OK //Public message echo '<h1>System Error</h1> <p class="error">Your password could not be changed due to a system error. we apologize for any inconvenience</p>'; //Debugging message echo'<p>' . mysqli_error($dbc) . '<br/><br />Querry: ' . $q . '</p>'; } //Include the footer and quit the script (to not show the form) include ('includes/footer.html'); exit(); } else { //Invaild email address/password combination echo'<h1>Error!</h1> <p class="error">The email address and password do not match those on file.</p>'; //WORKS! } } else { //Report the errors echo'<h1>Error!</h1> <p class="error">The following error(s) occured:<br />'; foreach($errors as $msg){ //Print each error. Iterates over arrays. echo" - $msg<br />\n"; } echo'</p><p>Please try again.</p><p><br /></p>'; } //End of if(empty($errors)) IF } ?> <h1>Change Your Password</h1> <form action="password.php" method="post"> <p>Email Address: <input type="text" name="email" size="20" maxlength="80" value="<?php if(isset($_POST['email'])) echo $_POST['email']; ?>" /> </p> <p>Current Password: <input type="password" name="pass" size="10" maxlength="20" /></p> <p>New Password: <input type="password" name="pass1" size="10" maxlength="20" /></p> <p>Confirm New Password: <input type="password" name="pass2" size="10" maxlength="20" /></p> <p><input type="submit" name="submit" value="Change Password" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form> <?php include('includes/footer.html') ?>
  8. Larry, In Script 8.3 password.php I cannot get the message: Thank You! Your password has been updated. In Chapter 11 you will actually be able to log in!". When I click the change password button it returns a blank page only showing the formatted CSS header. I have tested all of the possible errors by purposely typing in errors and they return the error messages. Sincerely, Gregory
  9. Larry, I just want you to know that I followed through on my promise to support you by not only recommending your books to others but by also purchasing your new book PHP for the Web 4th edition. In case, you forgot I am the on who was very grateful for helping me through several big road blocks several weeks ago with the PHP/MySQL exercises that had nothing to do with your book (PHP and MySQL) and everything to do with my unique MAMP configuration, MySQL Workbench and lack of experience. I also gave a 5 star review on Amazon of the PHP and MySQL book. Sincerely, Gregory Scarcell
  10. Thanks. I may just get the 07 edition since I can put that to use now. Gregory
  11. Larry, Before I decide to purchase PHP 5 advanced will there be a new edition this year (2011) since that edition is 2007? Gregory
×
×
  • Create New...