Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About AJugOrNot

  • Rank
  1. Thanks HartleySan! That works perfectly. And no problem with the "runaround", glad you could take some of your time and help me!
  2. Just tried that one too, it goes through now but allows things like 'f -$%fff' as a valid username. If a user were to try to put that in I want it to error out and tell them what is a valid input. Here is the whole validation block: //Validate username if (empty($_POST['username'])) { $errors[] = 'Please enter your username.'; } elseif (preg_match('/[\w`\\\\]{1,12}/', $trimmed['username'])) { $username = mysqli_real_escape_string($dbc, $trimmed['username']); } else { $errors[] = 'Please only use letters, numbers, and underscore.'; } Is maybe som
  3. Hi HartleySan, I received this error when I tried it: An error occurred in script ************** on line **: preg_match(): Compilation failed: missing terminating ] for character class at offset 12. Here is the code for that: elseif (preg_match('/[\w`\\]{1,12}/', $trimmed['username'])) { $username = mysqli_real_escape_string($dbc, $trimmed['username']); I then changed it to elseif (preg_match('/[[\w`\\]{1,12}]/', $trimmed['username'])) { $username = mysqli_real_escape_string($dbc, $trimmed['username']); (Added an extra bracket after the first backslash) and tried f-
  4. Hi, I'm trying to use a regular expression to limit user input by only allowing all capitol and lowercase letters, numbers, underscore, `, and \. I would like it to be 1-12 characters long and have no spaces. However, when I try to create it and put it into the prce.php, it still allows spaces and more than 12 characters. Here is what I am using: /[\w^\s`\\]{1,12}/ Any help would be appreciated, thank you. I am using PHP v 5.3.
  5. Hi everyone, sorry if this post doesn't have proper English, I'm really tired. So I know that php 5.5 uses some new type of encryption that is automatically a php function and is better because it is cracked slower (I think its bcrypt or something like that) I have tried looking online for the "best" way to save passwords, but every time I find a post I see another user saying that the last method just posted is easily crackable or shouldn't be used. From what I have read online, it seems the method used in the PHP and MySQL for Dynamic Web Sites book is not the most secure currently.
  6. That was the issue, I named the folder javascript instead of js........such a stupid mistake lol. Thanks HartleySan, got it working.
  7. I just have 1 image in the folder. The link comes up but when clicking it, nothing happens. It says that the function create_window is undefined when I try to debug in Chrome. I will try to do some more research on my javascript.
  8. Hi everyone, I am really enjoying your book Larry, thanks. My problem is I am on the page where you use the header function and javascript to display the images from the uploads folder. I have one picture and for some reason when I click it, it does nothing. Would anyone care to look at my code or give me some hints as to why it is not working? I have tried the following: Compare my code to Larry's code Used Larry's code Enabled pop-ups Moved the javascript folder to a different location (a folder above and then changing the a href to ../javascript) images.php <!DOCTY
  • Create New...