Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About phpstuff

  • Rank
    Advanced Member
  1. From #7 bottom of page 126: list($page_title) = mysqli_fetch_array($r, MYSQLI_NUM); Will having dynamic page titles have a negative impact on the pages SEO, or is the page title considered "static" once served?
  2. Can't connect to localhost for some reason. Running MAMP - just updated it. Here is what I have for my config.inc.php file: <?php if (!defined('LIVE')) DEFINE('LIVE', false); DEFINE('CONTACT_EMAIL', 'you@example.com'); // Send error messages to this email address when site is live DEFINE('BASE_URI', '/MAMP/htdocs'); // Should point to the PARENT of the web root directory DEFINE('BASE_URL', 'localhost:8888/'); // eg. www.example.com, localhost:8888/ DEFINE('MYSQL', BASE_URI . '/includes/mysql.inc.php'); session_start(); My mysql.inc.php file is in the includes folder.
  3. Haven't figured it out yet... Just kept on moving along through the book. Thank you for checking. If I should reference somewhere in this book or your other 2 (PHP, or PHP & MySQL) let me know and I'll go reference those pages.
  4. On the top right of the page it has this tip. How exactly would the code look to accomplish this? Lets say I wanted to insert 2 upper case letters in random positions within the generated password. Thank you for your help.
  5. For #9, "Add user to the database" part of the code is: $q = "INSERT INTO users (username, email, pass, first_name, last_name, date_expires) VALUES ('$u', '$e', '" . password_hash($p, PASSWORD_BCRYPT) . "', '$fn', '$ln', ADDDATE(NOW(), INTERVAL 1 MONTH) )"; $r = mysqli_query($dbc, $q); I'm wondering why there is concatenating going on: '" . password_hash($p, PASSWORD_BCRYPT) . "' What does this benefit? Isn't this info just being dumped into the database as a string?
  6. So it seems like when you hash a password that the hash is a constant related to the password. So, If Amazon.com hashes the user password "mysecretpw99" and the hash is: 1209j09j0939h480h2389g4h9823g4 And then Yahoo.com hashes the same user password "mysecretpw99" then the hash will be: 1209j09j0939h480h2389g4h9823g4 Is this correct? If so, wouldn't it be easy to build a database of potential password combos, hash all of the combos, then have a database filled with hashed values. Then compare those hashed values to the actual hashed passwords that users are using
  7. Odd, when I copy/paste the first part of the code I get normal results: CREATE TABLE `categories` ( `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `category` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `category_UNIQUE` (`category` ASC) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; This 2nd block of code starts having the issue where it asks for a Y/N confirmation: CREATE TABLE `pages` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `categories_id` SMALLINT UNSIGNED NOT NULL, `title` VARCHAR(100) NOT NULL, `description` TINYTEXT NOT NULL, `content` LO
  8. I'm glad I now know that it shouldn't do what it's doing above... I'll probably delete the database and start from scratch. Thank you for your help Larry!
  9. I'm actually on the same pages 53-54 getting similar errors, so figured I'd add to this same post - updating my MySQl version may fix the error aboce, but I'm getting a wierd error below. This happened when I copied / pasted (ctrl-v) into terminal...I didn't even hit "enter" and it looks like it started trying to run the code. mysql> CREATE TABLE `pages` ( -> `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, -> `categories_id` SMALLINT UNSIGNED NOT NULL, -> `title` VARCHAR(100) NOT NULL, -> `description` TINYTEXT NOT NULL, -> `content` LONGTEXT NULL, ->
  10. What percentage of the time on average would you use the Switch conditional vs. the else conditional?
  11. Thank you both very much for taking time out of your day to reply. I kinda feel like I'm whining a bit, and maybe I am, but I'm really wanting to see how people approach learning this stuff. This is a personal goal that will bring great satisfation once I'm there so I will never give up that is for sure. Once I finish this book 100% and review it, I'll be moving on to ecommerce and simultaneously working on the PHP/MYSQL for the website I designed...hopefully with this forum and the books I'll be able to knock out my first site... Thanks again for the positive words here.
  • Create New...