Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Deaddog

  • Rank
  1. Maybe you need to change: "js/tinymce/tinymce.min.js to "tinymce/js/tinymce.min.js" ? I think it is setup this way by default. Another thing, make sure your textarea is the same as the selector: "#content". It could be that you need to remove the # sign to match the textarea id in the form.
  2. You got me there, I had that one coming . I thought you went sort of easy on me, but you added a little salt in the wound at the end there with: It must be great to just whip up something like this in 30 minutes. A lifetime of practice I suppose. In my case, I spent a fair amount of time installing and getting the hang of the quick_form2, and really like it. Hopefully your example will sort of align with the code that the book uses. I'm really looking forward to your example, but take your time there is no big rush. I mean if you have to use 45 minutes....by all means.
  3. This forum claims it will "translate geek into English", but I have to say in this case it has gone from geek to just another version of geek. Unfortunately, on this specific oop forum (for this book), I have not read any success stories of someone implementing a registration form using oop techniques. The forum user senso attempted it, but never finished or never re-posted. I assume that user gave up due to frustration. I don't plan on doing that, I haven't spent hundreds of hours over the years and purchase four Ullman books to quit. The procedural way from PHP and MySQL for Dyna
  4. Step 1) Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety) Step 2) Place rubber duck on desk and inform it you are just going to go over some code with it, if that's all right. Step 3) Explain to the duck what your code is supposed to do, and then go into detail and explain your code line by line Step 4) At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way. Note: In a pinch a coworker m
  5. Continuing on, the part of the registration form that checks the username and email now works, using the first prepared statement. The next part is to insert the data which is, usertype, *username, *email, *pass, active, dateAdded. Those marked with * come from quickform2. usertype, active (random activation code) are giving me trouble. Below is the code I have tried: $q = 'INSERT INTO users (usertype, username, email, pass, active, dateAdded) VALUES (:usertype, :username, :email, pass=SHA1(:pass), :active, NOW()'; $usertype = 'publicUser'; $active = md5(uniqid(rand(), true)); $s
  6. I'm using var_dump($r) to try and troubleshoot this. Why does this query return boolean false? (regardless of what values I put in the form) if ($form->validate()) { $q = "SELECT COUNT(email) FROM users WHERE username=$username OR email=$email"; $r = $pdo->query($q); And this query return an object? (This works fine, there is no form input) //This is from Chapter 9, index.php) try{ $q = 'SELECT id, title, content, DATE_FORMAT(dateAdded, "%e %M %Y") AS dateAdded FROM pages ORDER BY dateAdded DESC LIMIT 1'; $r = $pdo->query($q); And this query return only boolean true?
  7. So, I have tried to use the getValue() like this, however, it produces two errors: Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens and Call to a member function fetchColumn() on a non-object'' Why? $q = 'SELECT COUNT(email) FROM users WHERE email=:email'; $stmt = $pdo->prepare($q); $r = $stmt->execute(array(':username'=>$username->getValue(), ':email'=>$email->getValue())); if ($r->fetchColumn() > 0){ I know you said in your previous post to use $pdo->query($q), but I'm s
  8. I thought that email value comes from the form? $email = $form->addElement('text','email');
  9. Thanks for the help so far. Why does A not work with $r->rowCount and B work? A is my attempt at making the registration form verify email addresses previously registered, email=:email comes from user input using QuickForms2 B is from Chapter 9, index.php. if ($form->validate()) { //A) This does not work with $r->rowCount($q): $q = 'SELECT COUNT(*) FROM users WHERE email=:email'; //B) This works with $r->rowCount($q): $q = 'SELECT id, title, content, DATE_FORMAT(dateAdded, "%e %M %Y") AS dateAdded FROM pages ORDER BY dateAdded DESC LIMIT 1'; $r = $pdo->query
  10. So I'm trying to make a simplified version of checking the email against the existing users, see code snippet: (For registration purposes). if($_SERVER['REQUEST_METHOD']=='POST'){ // Validate the form data: if ($form->validate()) { $results = $pdo->query('SELECT id FROM users WHERE email=:email'); //Review page 262 if ($results->rowCount() == 1){ echo 'Sorry, that username or email is previously registered!'; include('includes/header.inc.php'); include('views/register.html'); include('includes/footer.inc.php'); exit(); I keep getting the error, "Call to a membe
  11. For the sake of simplicity, I think I'm leaning towards adding the active to the user table. I'm going to make a page called registration.php. The script will check the email against the users table using a prepared statement. If that email is not previously registered it will insert the name, email, password and activation code on a second prepared statement. Is this basically what needs to happen? So the first hurdle is getting the oop/pdo equivalent of this: $q = "SELECT user_id FROM users WHERE email='$e'"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />M
  12. Thanks for the advice Larry. I will make an attempt at this and whatever I happen to conjure up, I'll post. If nothing else, I'm sure it will give some of the experienced OOP developers a chuckle . We'll see.
  13. This will be my first attempt to really dig into oop on my own, without copying the code directly from the book. It seems very overwhelming. Using the CMS from Chapter 9, I will try to expand on the registration form in order to add an activation code. The goal is that when a new user registers, an activation link will be sent by email. I know this procedural method from one of Larry's previous books. For the oop, I really need some help to get things started in the right direction. So far, I've added a column to the users table called active. A char(32), default NULL. Added an
  14. The answer to this is simple: Took the dog for a walk, came home and re-read through chapter 8, the part where it says "Note that this does assume that the classes and class files use the same exact names( minus the extensions)." So I just changed the file classes/page.php to classes/Page.php. Such details. Strange that it worked fine on local machine with the lowercase page.php, but not on the live server. Problem solved.
  • Create New...