Jump to content
Larry Ullman's Book Forums

rafaec

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About rafaec

  • Rank
    Newbie
  1. I use Dreamweaver CS 5.5... I'll try uploading it to a hosting server and see what happens. Thank you for your help!
  2. Hi, The "unknown problem" alert is set by me to know there was a problem with responseText: if (ajax.responseText == 'VALID') { console.log('works'); alert('You are now logged in!'); } else if (ajax.responseText == 'INVALID') { console.log('failed'); alert('The submitted values do not match those on file!'); } else { alert ('Unknown problem') } I did comment each chunk of code, verified all the commands, even copy pasted from Larry's. I am now absolutely positive the problem is in this validation. For some reason, PHP returns 'VALID' but the var is set to 'VALID\r\n\r\n '.
  3. Hi HartleySan, Thanks for your reply. I changed that before with no success. I actually tried using the login.js from Larry's website directly to rule out any typos... The console does not output "works" or "failed". Browser just alerts "Unknown problem". ??
  4. New info: When establishing a break point after alert('You are now logged in!'); ajax.responseText shows value of "VALID\r\n\r\n ". I really have no idea where is it getting the /r/n values from. PHP is basically if (...$_POST[...) // validate and set email and password to me@example.com and testpass { echo 'VALID'; } else { echo 'INVALID'; } no new lines no enters... ???
  5. Hi everyone, me again... I have broken my head over this one...no idea why it doesn't work. HTTP: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form action="login.php" method="post" id="loginForm" novalidate> <fieldset> <legend> Login </legend> <div><label for="email"> Email adress </label> <input type="email" name="email" id="email" required /></div> <div><label for="password"> Password </label> <input
  6. I was running them in Firebug console...also tried it in Chrome console...same issue. But you are right, when you run the whole code like that it works. Anyone have any idea why do you get such an error in console???
  7. Hi everyone, So, I am doing the zip code validator on the text: var regexp = /^\d{5}(-\d{4})?$/; regexp.test (15265-5325) returns false var regexp = /^\d{5}(-\d{4})?$/; // same code regexp.test (15265-3325) returns true I have realized that unless the first number after the hyphen is less than 4, the expression will return false. I tried putting ^ inside parenthesis with first (). Fixes error. But if the first digit is 1 or 0 returns false. >>> var regexp = /(^\d{5})(-\d{4})?$/; regexp.test (85265-5325) true >>> var regexp
  8. Hey Larry, Love your book btw. I have one question: On the "Pursue" item 3, on Chapter 9. It says to "rewrite customize.php so the script also applies the user's preferences." What do you mean by that? Could you post the solution here? Is the question telling you to make the "customize.php" page to set the css stylesheet to the cookie values once the cookie is set? In this case, can you comment if my code is correct? Please clarify Thanks! <?php //customize.php cookie handling if (isset($_GET['font_size'], $_GET['font_color'])) { //SEND THE COOKIES! setcoo
×
×
  • Create New...