Jump to content
Larry Ullman's Book Forums

lindsd1111

Members
  • Content Count

    28
  • Joined

  • Last visited

  • Days Won

    1

lindsd1111 last won the day on February 23 2015

lindsd1111 had the most liked content!

Community Reputation

1 Neutral

About lindsd1111

  • Rank
    Member
  1. Hi. I've been using your Chapter 4 login code for a while now and it works well. But I'd like to make an enhancement. Right now, in the login_form.inc.php, the form code is this: <form action="index.php#loginform" method="post" accept-charset="utf-8"> I use the #loginform because I have placed the login div at the bottom of my page. It needs to take the user back to the bottom of the page if the login is unsuccessful because otherwise they will not see the error messages that the login was unsuccessful. It works well, EXCEPT that if the user logs in successfully, then they are still stuck at the bottom of the page. I would like to change it so that if the user logs in successfully, they are taken to the top of the page. (BTW, you can see the actual site here: www.readinesstest.com) Anyone have a thought on how to accomplish this? I've tried a handful of things but they didn't work. Thanks! --David
  2. Just an update: I was never able to fix the problems. After a while, MySQL simply stopped working all together. The only thing that ultimately "fixed" the problem was not only to uninstall and reinstall XAMPP, but I also had to manually blow away all the XAMPP folders and files after uninstalling and before reinstalling. I would advise anyone upgrading to Yosemite to: - Save off a copy of each DB - Save off a copy of all PHP / code files Then it's just an "easy" matter of copying back the php files and importing the DBs.
  3. Thanks for your response, Antonio. Your advice is always helpful. Sorry I didn't reply sooner; I was sorting out the post-Yosemite upgrade problems. Anyway, I am not advanced enough to follow your suggestions, but they did get me started enough to come up with my own solution. I share it here in case it's helpful to others. FYI, this was for a group of test users I created, all with a sequential number at the end of their name. <?php include('../includes/database.php'); for ($i=1; $i < 51; $i++) { $pass = "NewPassword4321"; $user = "NameOfSequentialUser" . $i; $query = "UPDATE users SET pass='" . password_hash($pass, PASSWORD_BCRYPT) . "' WHERE username='$user' "; echo $query; //Write results to DB $mysqli->query($query) or die(); $query = ""; reset($mysqli); echo "Complete for" . $user . "!</br>"; } echo "ALL complete";
  4. I'm probably missing something obviously stupid, but appear not to have that file structure: "-bash: cd/usr/local: No such file or directory" My path on a Mac using XAMPP to get to phpMyAdmin is: Applications > XAMPP > xamppfiles > phpmyadmin The mysql path is: Applications > XAMPP > xamppfiles > mysql If I run the ls -al on this path: Applications > XAMPP > xamppfiles > var > mysql I get this result: -bash: is: command not found I'm sure I'm missing something very basic; sorry!
  5. Could it possibly be related to folder permissions under xamppfiles > var > mysql? Not sure what I'd change there??
  6. Thank you, Larry. That's what I think too, but can't figure out how to solve it. Could you provide a bit more information as to how to do that? I have set passwords for all users and added the passwords to the config.inc.php file. Screenprint: https://drive.google.com/open?id=0B9uvP7GK92uPWmpkV0w4Z1RFdms&authuser=0 Can't think of what to try next...
  7. I posted this on Apache Friends but thought I'd post here too. I upgraded to Yosemite. I downloaded and installed the most recent version of XAMPP. I changed / updated the root and pma passwords in the config.inc.php file. I can see all DBs and tables, but cannot access any tables (!! exception = I can access the phpmyadmin tables). I can create new tables in any DB. Every time I get a #1146 - Table ... doesn't exist error. It is exactly the same problem as described here on stack overflow (with no solution): http://stackoverflow.com/questions/26438068/xampp-not-working-os-x-yosemite HELP! Thanks!
  8. I have a need to generate many (50+) accounts. I can do this rather easily directly in the DB using PHPMyAdmin or the like. EXCEPT for the passwords. I am following the password creation methods using a hash as you have laid out in your book. Thus I cannot figure a way to create them directly in the DB because of the hash encoding used in the PHP code. Is there a way to create passwords without having to create them in the registration / edit user pages? Can it be done directly in something like PHPMyAdmin? Alternatively, is there a way to quickly create multiple accounts? (They could even have all the same password in this particular case I need). Hopefully the topic and questions make sense. Thanks! --David
  9. Hi Larry (and all). I had a problem on my VPS that forced me to look a bit more closely at cleaning strings before writing them to MySQL. So this got me to wonder: What is the difference between escape_data() and $mysqli->real_escape_string()? Larry uses functions like this one during the login process: $fn = escape_data($_POST['first_name'], $dbc); Other authors suggest functions like this one: $fn = $mysqli->real_escape_string($_POST['first_name']); Can someone explain the difference between them (and which one is "preferred")?
  10. Thanks @HartleySan (fellow Buckeye!); that makes sense. Newbie followup question: This method assumes that the user will perform some activity (like loading a page) that will then log them out using your function; is there a way to log them out automatically without them performing an action? So if they simply close their browser without ever logging out? I assume this would have to take place on the server side, and perhaps would be too complicated, but thought I'd ask for security reasons.
  11. I was hoping that someone might be able to provide a few lines of code that would automatically log the user out after 20 or 30 minutes of inactivity. Maybe the code could be placed in the config.inc.php file so that it gets run frequently? (Note: I am using the "First Site" as created in chapters 1-6 of Larry's book.) Thanks!
  12. Resolved with a work-around using cookies. It looks like this is not such an uncommon problem. Here is a helpful article: http://stackoverflow.com/questions/17242346/php-session-lost-after-redirect I went with the cookie solution, but in the future I might experiment with this: session_save_path('"your home directory path"/cgi-bin/tmp'); session_start();
  13. I thought of that too, Larry. But that doesn't appear to be the problem. I verified that my website is using https:// on the page where the user clicks the PayPal button. Then I verified that PayPal was redirecting back to: https://www.readinesstest.com/thanks... So it would seem that the user stays within https:// settings the whole time (unless maybe the PayPal sandbox site is not https:// and that is what destroys the sessions? Any help you or others could offer would be great. I guess the next step is to try implementing the pdt.php but I'm a little gun-shy at this point...
  14. After the user goes to PayPal and makes a successful purchase, the user is redirected back to the "thanks.php" page on my site (in accord with Chapter Six). But there is no _SESSION information available! Therefore the "thanks.php" will not run properly, because it doesn't have the user_id or reg_user_id to be able to write it to the database. Help? Important Note: I am not (yet) using the pdt.php; I'm trying to make it work without it for now.
×
×
  • Create New...