Jump to content
Larry Ullman's Book Forums

Christopher Bergin

Members
  • Posts

    90
  • Joined

  • Last visited

Posts posted by Christopher Bergin

  1. I'm trying to understand the process of events taking place in Chapter 15. My first question applies to declaring a generic object:

    are the properties assigned to the object user-defined or are they available system-defined properties?

     

     

    options.data = data;

    options.dataType = 'text';

    options.type = 'get';

    options.success = function(response)

     

    My second question: when this instruction is executed in the login.js script, are all the property / value pairs that comprise the generic object appended to the GET URL and sent to login_ajax.php for processing?

     

    $.ajax(options);

  2. In this lesson, Larry uses an elegant solution to populate the scrubbed array:

     

    $scrubbed= array_map ('spam_scrubber', $_POST);

     

    I thought I'd try a more traditional route just to see if I could and I'm having difficulty. Can anyone correct this logic for me?

     

     

    if ($_SERVER['REQUEST_METHOD'] == 'POST')

    //$scrubbed= array_map ('spam_scrubber', $_POST);

    {$scrubbed= array();

    foreach ($_POST as $v)

    $scrubbed= spam_scrubber($v);

     

    if (!empty($scrubbed['name']) && !empty($scrubbed['email']) && !empty($scrubbed['comments']))

    {$body= "Name: {$scrubbed['name']}\n\nComments:{$scrubbed['comments']}";

    $body= wordwrap($body, 70);

    mail('postoffice@cjbergin.com', 'Contact Form Submission', $body);

    print "<p><em>Thank-you for contacting me. </em></p>";

    $_POST= array();}

    else

    print "<p><b>Please fill out the form completely!</b></p>";}

     

     

    all the other sections of the script work according to plan. The output I'm receiving is just one character per field:

     

    Name: s

     

    Comments:s

  3. I got it to work but only erratically. I suspect it might have something to do with the capricious nature of headers. For instance, the trace I inserted in the function would not generate output unless the script worked successfully and an image in it's own window displayed properly. I used the function provided by the author and it seemed to work. When I replaced (copy/paste) the function code I had written with that of the authors, it still failed to work. I'm done with this and moving on.

  4. I'm having difficulty getting my images to appear in their cute little windows. To enlighten those mildly familiar with the project, images.php scans the directory that .jpg images reside (already confirmed they are uploaded) and establishes the filename and dimensions of each image, creates a list of links that invoke a Javascript function that creates a pop-up window, which in turn calls show_image.php to display the image. When I click on the link, the page does nothing. I receive no errors from the scripts and I receive no error from the browser indicating that href resource does not exist. I tried including write statements in the Javascript function to see if it was in fact processing a request but I don't see that either. I've tested on Safari 5.0.6 and Firefox 3.0.7. Any ideas?

  5. The book mentions that this could happen but doesn't offer any advice.

     

     

    Successfully connected to MySQL!

    Could not create database because:Access denied for user 'cjbergin'@'10.%' to database 'myblog'

    Could not select database because:Access denied for user 'cjbergin'@'10.%' to database 'myblog'

     

     

     

     

     

    I seem to be able to manually create databases if I access MySQL from the control panel of the hosting site. When I attempted to manually create 'myblog', I was greeted with a MySQL message indicating that it was already created but yet I don't see it existing in the GUI .

  6. I'm having trouble getting my cookie values created in customize.php to modify the text in view_settings.php. When I view the stored cookies on my Mac 10.5.8 (Safari 5.0.6), they appear in the list of cookies. In fact, when I make different selections for font_size and font_color, they are reflected in the browser list of cookies as intended. The problem appears when the view_settings.php page is not affected by the change in values. I tried to print out the values of font_size and font_color after the setcookie commands on the customize.php page but receive no values for each.

     

    setcookie('font_size', $_POST['font_size'], time()+1200);

    setcookie('font_color', $_POST['font_color'], time()+1200);

    print "<p> the font size is..." . $_COOKIE['font_size'] . "and the font color is..." . $_COOKIE['font_color'] . "</p>";

     

    I get this result...

     

    the font size is...and the font color is...

    Your settings have been entered! Click here to see them in action.

     

    The values for $_POST['font_size'] and $_POST['font_color'] are available and correct when I print them out.

    I even tried to upload script_09_01.php and script_09_02.php directly to the web hosting server that I am using and those did not work either. Any ideas?

×
×
  • Create New...