Jump to content
Larry Ullman's Book Forums

jayLim

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by jayLim

  1. Hello!

    In chapter 6 "Testing the Site", after I click the paypal subscription button, I get this error message :

     

    Error Detected

    pixel.gifPayPal cannot process this transaction because of a problem with the seller's website. Please contact the seller directly to resolve this problem.

     

    I've tried using different test accounts and I get the same thing.

    Here are the codes for the paypal button:

     

    echo '<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">

    <input type="hidden" name="cmd" value="_s-xclick">

    <input type="hidden" name="hosted_button_id" value="FDN9DZRLVBQRL">

    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">

    </form>';

  2. Ok, that was a bit unclear.

     

    When I first enter the main home page (index.php), I see all the content and in the sidebar there is the login form which I get ask to type the email address and password in order to login, I have no problem with that. Once I am logged in I can navigate the site with no issue at all, but when I click the Home tab (which takes me to index.php) in the nav bar, the login form would show once again even though I was already logged in. What I am guessing is that it logged me out, because I don't see  Account and Admin since the user has to be either an admin or a normal user to see those tabs.

     

    J.

  3. Hello Forum!

     

    Is anyone else getting this kind of message when uploading a pdf file?

     

    An error occured in script '/Users/jlim/Website/effortless_ecommerce_2nd/ex1_exercise/html/add_pdf.php' on line 42:
    move_uploaded_file(/Users/jlim/Website/effortless_ecommerce_2nd/ex1_exercise/pdfs/8186af9a73f8c66e321ef0062bddd5b0848a7cc95354042444b3e6.27501040_tmp): failed to open stream: No such file or directory

    Array(    [0] => Array        (            [function] => my_error_handler            [args] => Array                (

    ...

    thanks

    J.

  4. Hello Forum!

     

    I realized something strange, why does my login form gets logged in without for me actually typing in an Email Address and Password, in other words when I leave the form empty and press the login button, for some reason it takes me to index.php welcoming page.  The form also logs in when I type some random email address and password, therefore I don't see any error messages whatsoever such as "Please enter a valid email address!". I have no problem with the registration form, changing a new password and logging out. I'm sure all the codes are fine. By the way I am using MAMP to test the pages out.

     

    Thanks.

    J.


  5. <?php


    require('./includes/config.inc.php');


    redirect_invalid_user('user_admin');


    require(MYSQL);


    $page_title = 'Add a Site Content Page';
    include('./includes/header.html');


    $add_page_errors = array();


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


    if(!empty($_POST['title'])) {
    $t = ecape_data(strip_tags($_POST['title']), $dbc);
    } else {
    $add_page_errors['title'] = 'Please enter thre title!';
    }


    if(filter_var($_POST['category'], FILTER_VALIDATE_INT, array('min_range' => 1))) {
    $cat = $_POST['category'];
    } else {// No category selected.
    $add_page_errors['category'] = 'Please select a category!';
    }


    if(!empty($_POST['description'])) {
    $d = escape_data(strip_tags($_POST['description']), $dbc);
    } else {
    $add_page_errors['description'] = 'Please select the description!';
    }


    if(!empty($_POST['content'])) {
    $allowed = '<div><p><span><br><a><img><h1><h2><h3><h4><ul><ol><li><blockquote>';
    $c = escape_data(strip_tags($_POST['content'], $allowed), $dbc);
    } else {
    $add_page_errors['content'] = 'Please enter the content!';
    }


    if(empty($add_page_errors)) {
    $q = "INSERT INTO pages(categories_id, title, description, content) VALUES($cat, '$t', '$d', '$c')";
    $r = mysqli_query($dbc, $q);


    if(mysqli_affected_rows($dbc) === 1) {
    echo '<div class="alert alert-success"><h3>The page has been added!</h3></div>';


    $_POST = array();


    } else {//If it did not run ok.
    trigger_error('The page could not be added due to a system error. We apologize for any inconvenience.');
    }
    }//End of $add_page_errors if.
    } //End fothe main form submission conditional.


    require('includes/form_functions.inc.php');
    ?>
    <h1>Add a Site Content Page</h1>
    <form action="add_page.php" method="post" accept-charset="utf-8">
    <fieldset><legend>Fill out the form to add a page of content:</legend>
    <?php
    create_form_input('title', 'text', 'Title', $add_page_errors); 


    echo '<div class="form-group';
    if(array_key_exists('category', $add_page_errors)) echo ' has-error';
    echo '"><label for="category" class="control-label">Category</label>
    <select name="category" class="form-control">
    <option>Select One</option>';


    $q = "SELECT id, category FROM categories ORDER BY category ASC";
    $r = mysqli_query($dbc, $q);
    while($row = mysqli_fetch_array($r, MYSQLI_NUM) {
    echo "<option value=\"$row[0]\"";
    if(isset($_POST['category']) && ($_POST['category'] == $row[0])) echo ' selected="selected"';
    echo ">$row[1]</option>\n";
    }
    echo '</select>';
    if(array_key_exists('category', $add_page_errors)) echo '<span class="help-block">' . $add_page_errors['category'] . '</span>';
    echo '</div>';


    create_form_input('description', 'textarea', 'Description', $add_page_errors);
    create_form_input('content', 'textarea', 'Content', $add_page_errors);
    ?>
    <input type="submit" name="submit_button" value="Add This Page" id="submit_button" class="btn btn-default">


    </fieldset>
    </form>
    <?php 
    include('./includes/footer.html'); 
    ?>

     

  6. Hello Forum

    In Chapter 5 Creating the Basic Script, the add_page.php file, when testing out I get this message:

     

    Parse error: syntax error, unexpected '{' in /Users/jlim/Website/effortless_ecommerce_2nd/ex1_exercise/html/add_page.php on line 70

     

    I've also tried the original add_page.php file and I also get the same exact message. These are the ones I wrote:

     

    ...

     

    <h1>Add a Site Content Page</h1>
    <form action="add_page.php" method="post" accept-charset="utf-8">
    <fieldset><legend>Fill out the form to add a page of content:</legend>
    <?php
    echo '<div class="form-group';
    if(array_key_exists('category', $add_page_errors)) echo ' has-error';
    echo '"><label for="category" class="control-label">Category</label>
    <select name="category" class="form-control">
    <option>Select One</option>';
     
    $q = "SELECT id, category FROM categories ORDER BY category ASC";
    $r = mysqli_query($dbc, $q);
    while($row = mysqli_fetch_array($r, MYSQLI_NUM) {
    echo "<option value=\"$row[0]\"";
    if(isset($_POST['category']) && ($_POST['category'] == $row[0])) echo ' selected="selected"';
    echo ">$row[1]</option>\n";
    }
    echo '</select>';
    if(array_key_exists('category', $add_page_errors)) echo '<span class="help-block">' . $add_page_errors['category'] . '</span>';
    echo '</div>';
     
    create_form_input('description', 'textarea', 'Description', $add_page_errors);
    create_form_input('content', 'textarea', 'Content', $add_page_errors);
    ?>
    <input type="submit" name="submit_button" value="Add This Page" id="submit_button" class="btn btn-default">
     
    </fieldset>
    </form>
    <?php 
    include('./includes/footer.html'); 
    ?>
  7. Yes of course, I rewrote the original location of the files just to abbreviate the error message. This is what I really get:

     

    An error ocurred in script '/Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php' on line 9: require(/Users/jlim/Website/phpmysql4_scripts/mysqli_connect.php): failed to open stream: No such file or directory
    Date/Time: 3-10-2014 22:05:33

    Array(    [_GET] => Array        (        )    [_POST] => Array        (            [first_name] =>             [last_name] =>             [email] =>             [password1] =>             [password2] =>             [submit] => Register        )

    ...

     

    Fatal error: require(): Failed opening required '/Users/jlim/Website/phpmysql4_scripts/mysqli_connect.php' (include_path='.:/Applications/MAMP/bin/php/php5.5.3/lib/php') in /Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php on line 9

     

     

    It's really strange, shouldn't be happening?!

     

    J.

  8. Hello!

     

    I can't understand why I get this when testing out the registration form in Chapter 18: 

     

    An error ocurred in script '/path/to/html/register.php' on line 9: require(/path /to/mysqli_connect.php): failed to open stream: No such file or directory
    Date/Time: 3-9-2014 18:32:41
    Array(    [_GET] => Array        (        )    [_POST] => Array        (            [first_name] =>             [last_name] =>             [email] =>             [password1] =>             [password2] =>             [submit] => Register        )    [_COOKIE] => Array        (            [SQLiteManager_currentLangue] => 2            [PHPSESSID] => efb1be7b8cd02e45109c9bac0e78854a        )    [_FILES] => Array        (        )    [_SERVER] => Array        (            [HTTP_HOST] => localhost:8888            [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8            [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5            [HTTP_ACCEPT_ENCODING] => gzip, deflate            [HTTP_REFERER] => http://localhost:8888/html/register.php            [HTTP_COOKIE] => SQLiteManager_currentLangue=2; PHPSESSID=efb1be7b8cd02e45109c9bac0e78854a            [HTTP_CONNECTION] => keep-alive            [CONTENT_TYPE] => application/x-www-form-urlencoded            [CONTENT_LENGTH] => 67            [PATH] => /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin            [SERVER_SIGNATURE] =>             [SERVER_SOFTWARE] => Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 PHP/5.5.3            [SERVER_NAME] => localhost            [SERVER_ADDR] => ::1            [SERVER_PORT] => 8888            [REMOTE_ADDR] => ::1            [DOCUMENT_ROOT] => /Users/jlim/Website/phpmysql4_scripts/ch18_exercise            [SERVER_ADMIN] => you@example.com            [SCRIPT_FILENAME] => /Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php            [REMOTE_PORT] => 51723            [GATEWAY_INTERFACE] => CGI/1.1            [SERVER_PROTOCOL] => HTTP/1.1            [REQUEST_METHOD] => POST            [QUERY_STRING] =>             [REQUEST_URI] => /html/register.php            [SCRIPT_NAME] => /html/register.php            [PHP_SELF] => /html/register.php            [REQUEST_TIME_FLOAT] => 1394404361.57            [REQUEST_TIME] => 1394404361            [argv] => Array                (                )            [argc] => 0        )    [page_title] => Register    [_SESSION] => Array        (        ))

    Fatal error: require(): Failed opening required '/path/jlim/to/mysqli_connect.php' (include_path='.:/Applications/MAMP/bin/php/php5.5.3/lib/php') in /path/to/html/register.php on line 9

     

    Thanks

×
×
  • Create New...