Johnamc328 Posted March 24, 2015 Share Posted March 24, 2015 Hello, I am trying to use the example through Godaddy and they fail the password_hash test. Chapter four protecting passwords. Your book said this site had another work around to get that to work - could I have it? Thanks, Jake Link to comment Share on other sites More sharing options...
Johnamc328 Posted March 24, 2015 Author Share Posted March 24, 2015 I found a similar question and tried this require("./lib/PasswordHash.php");$hash = new password_hash(8, false); $q = "INSERT INTO users (username, email, pass, first_name, last_name, date_expires) VALUES ('$u', '$e', '" . password_hash($p, PASSWORD_BCRYPT) . "', '$fn', '$ln', SUBDATE(NOW(), INTERVAL 1 DAY) )"; but I get this error Fatal error: Class 'password_hash' not found in html\ecommerce2\register.php on line 94 Link to comment Share on other sites More sharing options...
Johnamc328 Posted March 25, 2015 Author Share Posted March 25, 2015 I'm not sure why the include file is not being seen - I get thie error Call to undefined function password_hash() I am using this include - include('./lib/PasswordHash.php'); If I copy the function to the page it finds the function - why won't it see the include? _ have checked the path and all the other includes work fine Link to comment Share on other sites More sharing options...
Larry Posted March 25, 2015 Share Posted March 25, 2015 What version of PHP are you using? Also, where did you obtain the PasswordHash.php file from? Link to comment Share on other sites More sharing options...
Johnamc328 Posted March 25, 2015 Author Share Posted March 25, 2015 Hi Larry, Godaddy is at 5.4 but the site would not work until I reverted it back to 5.3. This is the link I found from another comment here https://sunnyis.me/blog/secure-passwords Link to comment Share on other sites More sharing options...
Larry Posted March 26, 2015 Share Posted March 26, 2015 Is there a reason you're not using the instructions I put in the book, and specifically the standard password hashing library found here: https://github.com/ircmaxell/password_compat ? Link to comment Share on other sites More sharing options...
Johnamc328 Posted March 26, 2015 Author Share Posted March 26, 2015 I followed the wrong link from an earlier question about the same thing. I made the changes and here is what I have require "lib/password.php";$hash = password_hash($password, PASSWORD_BCRYPT); An error occurred in script '\html\ecommerce2\register.php' on line 94:Undefined variable: password I have found out that I am having a problem with my IIS 7.5 - It will not see "require" - I am still trouble shooting to get the IIS correct. I will post my finding for future reference. Thanks Link to comment Share on other sites More sharing options...
Johnamc328 Posted March 26, 2015 Author Share Posted March 26, 2015 Upgraded back to 5.4 which is the highest Godaddy has - waiting on tech support since it bombs certain pages. Link to comment Share on other sites More sharing options...
Recommended Posts