Search the Community
Showing results for tags 'password'.
-
Dear Larry, I started learning MySQL through your book. To get started, I followed you instruction to set a password to the root using MyPhpAdmin. After I have entered the password, I updated the config.inc.php file to include the password. However, I am no longer able to access the root ever since. The error message is 1045, Access denied for user root@local host (using password:YES). I researched the web for password reset but the techniques (MySQLD) could not resolve my problem. Could you advise what I can do. Thank you so much.
-
On pp. 84-85 you discuss password hashing techniques with php version 5.5 or higher as well as php version 5.3.7 or greater. Unfortunately, my hosting platform uses 5.2.x and I'm not certain if I can get it upgraded. Please point me to alternative hashing approaches that will be compatible with older versions of php. Thanks in advance.
-
I am having problems with password.php script. I believe that I have followed the book precisely, but maybe not since I am here. Nonetheless, I continue to receive an error msg after I submit the form for the new password. the msg is that - The email address and the password do not match those on file. I have double and triple, and quadruple checked to make sure that I am submitting the correct info that I registered with. My other two scripts associated with the password.php are operating properly (view_users.php & register.php); including populating the correct error msgs when forms are not correctly filled in. The only thing that I believe might be an issue outside of the script, is that it calls for an interaction with the user_id (database I'm guessing), which was not coded for per the book (I double checked a number of times). I did update the view_users.php so that it counts the number of users but I still do not see where it calls for an id in the script. And also, how do I get my script to show up as the colors of my text editor without manually changing. I use TextWrangler and have a Mac - Thanx again <?php # script 9.7 - password.php // this script allows users to change password $page_title = 'Change Your Password'; include ('include/header.html'); //check for submission: if ($_SERVER['REQUEST_METHOD'] == 'POST') { require ('mysqli_connect.php'); // connect to database $errors = array(); // initalize an error array if (empty($_POST['email'])) { $errors[] = 'you forgot to enter a email.'; } 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 does not match your confirmed password.'; } else { $np = mysqli_real_escape_string($dbc, trim($_POST['pass1'])); } } else { $errors[] = 'you forgot to enter your a new password.'; } if (empty($errors)) { // if there are no errors // Check that they've enetered the right email address/password combination //make the query $q = "SELECT users_id FROM users_info WHERE (email='$e' AND pass=SHA1('$p') )"; $r = mysqli_query($dbc, $q); //@ $num = mysqli_num_rows($r); //@ if ($num == 1) { // match was made // get user_id $row = mysqli_fetch_array($r, MYSQLI_NUM); // make the UPDATE query $q = "UPDATE users_info SET pass=SHA1('$np') WHERE user_id=$row[0]"; $r = mysqli_query($dbc, $q); //@ if (mysqli_affected_rows($dbc) == 1) { // if it ran ok // print a message echo '<h3>Thank You!</h3> <p>Your password has been changed/updated.</p> <p><br /></p>'; } else { // if it did not run OK // public message echo '<h2>system error</h2> <p class="error"> your password could not be changed due to a system error. We apologize for any inconvenience.</p>'; //debugging msg echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>'; } mysqli_close($dbc); // //close db connection include ('include/footer.html'); // include the footer and quit the script (to not show the form). exit(); } else { // Invalid email address/password combination - return error echo '<h1>Error!</h1> <p class="error">The email address and the password do not match those on file<p/>'; } } else { echo '<h1>Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /><p>'; } // end of if (empty($error)) IF. mysqli_close($dbc); // close database connection } // end of main submit conditional. ?> <h1>Change your password</h1> <form action="password.php" method="post"> <p>Email: <input type="text" name="email" size="19" maxlength="16" placeholder="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <p>Current Password: <input type="password" name="pass" size="15" maxlength="10" placeholder="current" value="<?php if (isset($_POST['pass'])) echo $_POST['pass']; ?>" /></p> <p>New Password: <input type="password" name="pass1" size="15" maxlength="10" placeholder="password" value="<?php if (isset($_POST['pass1'])) echo $_POST['pass1']; ?>" /></p> <p>Confirm Password: <input type="password" name="pass2" size="15" maxlength="15" placeholder="re-password" value="<?php if (isset($_POST['pass2'])) echo $_POST['pass2']; ?>" /></p> <p><input type="submit" value="update/change" /></p> </form> <?php include ('include/footer.html'); ?>
- 10 replies
-
- password
- change your password
-
(and 2 more)
Tagged with:
-
I have downloaded script 8.7 from the LU web site and installed it on my web site as part of working through the book. However, every time I enter the correct information it keeps telling me the email and password do not match. I can't find any errata details for this or any listings on the Forum. Any ideas?
- 4 replies
-
- chapter 8
- script 8.8
-
(and 1 more)
Tagged with:
-
Hello again, friends! I changed my password in MySQL, keeping the "root" component for the username. However, when I go into PHPmyadmin by typing localhost and then entering the PHPMyAdmin section, access is denied with the following message: "phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server." I am wondering what I need to do to be able to access the PHPMyAdmin area as I haven't done any work at all in PHPMyAdmin up to this stage. Please kindly advise--hopefully with some detail about the code if I need to re-enter the password and username I used in MySQL into PHPMyAdmin. Thank you!