Jump to content
Larry Ullman's Book Forums

Georgezx9

Members
  • Posts

    16
  • Joined

  • Last visited

Posts posted by Georgezx9

  1. Hi I have used Larrys excellent login, to act as a login for a photo gallery. I have used the session ID check.
     
    The gallery code is HTML, but have used the session ID check to see if a person is logged in and saved it as a php file (in this case GYindex.php)
     
    I am using XAMPP, and my root folder is sites, I have the usual includes and js folders, but now have new folder called photogallery, this is where the photos and php/HTML code sits.
     
    The code is:

    1. <?php
    2. require ('includes/config.inc.php');
    3. $page_title = 'Logout';
    4. include ('/includes/header-pgallery.html');
    5.
    6. //If no first_name session variable exists, redirect the user:
    7. if (!isset($_SESSION['first_name'])) {
    8. $url = BASE_URL . 'index.php'; // Define the URL.
    9. $url='http://localhost/index.php';
    10. echo '<h3>You are not logged in.</h3>';
    11. ob_end_clean();// Delete the buffer.
    12. header("Location: $url");
    13. exit(); // Quit the script.
     
    Etc
    Etc
     
    I get the following error:

    Warning: require(includes/config.inc.php): failed to open stream: No such file or directory in F:\Sites\GeorgesPhotos\GYindex.php on line 2

    Fatal error: require(): Failed opening required 'includes/config.inc.php' (include_path='.;C:\xampp\php\PEAR') in F:\Sites\GeorgesPhotos\GYindex.php on line 2

     

    thanks in advance

  2. Hi, I have the login system working well now, with some extra bits, the login takes me to a new photogallery in HTML, but I only want registered users to see the gallery, therefore I have copied code from other bits of chapter 18 as follows: I.e it only executes the HTML if the session variable is set, this all works, but what this does is puts a banner from the header.html file, with "User Registration on the screen and a bar across, I don't want this, I simply want a blank screen, as the new HTML page sets its own CSS styles, whats best way to do this. If I remove header from the page it wont load

     

    <?php

     

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

    $page_title = 'Logout';

    include ('includes/header.html');

     

    //If no first_name session variable exists, redirect the user:

    if (!isset($_SESSION['first_name'])) {

     

     

    $url = BASE_URL . 'index.php'; // Define the URL.

    $url='http://localhost/index.php';

    echo '<h3>You are not logged in.</h3>';

    ob_end_clean();// Delete the buffer.

    header("Location: $url");

    exit(); // Quit the script.

    }

    Else

    {

    ?>

    //<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en">

    ..

    ..

    ..

     

    <?Php

    }

    ?>

  3. Just tried again still no joy

     

    Changed config.inc.php to have

     

    define ('BASE_URL', 'http://localhost/');

     

    The link in the activation Email is:

     

    http://localhost/activate.php?x=root%40localhost.com&y=e904d489139bb82634a1683fa311aa1d

     

    I get the account activation error URL as:

     

    http://localhost/activate.php?x=root%40localhost.com&y=e904d489139bb82634a1683fa311aa1d

     

    With a message of:

     

    Your account could not be activated. Please re-check the link or contact the system administrator.

  4. Hi all.

     

    Just got Ch 18 working, except for the registration, when I click on the activation link, It give me an error.

     

    I am using XAMP and localhost to test, what should I replace www.example.com in config.inc.php with?

     

    // Site URL (base for all redirections):

    define ('BASE_URL', 'http://www.example.com/');

     

    Also

     

    How is the mail address used, as all mail comes from postmaster, not the address defined, as below, I am using the mercury mail server

     

    // Admin contact address:

    define('EMAIL', 'mymailaddress@me.com');

     

    Thanks in advance

  5. Some of the error is given below, the only difference is the order, but that should not matter. the actual code is exactly as the download from Larrys site.

     

    The database is set up using the code from the book, and appears correct.

     

     

     

    An error occurred in script 'F:\Sites\register.php' on line 63: Query: INSERT INTO users (email, pass, first_name, last_name, active, registration_date) VALUES ('1@2.com', SHA1('zzzzzzzz'), 'xx', 'yy', '38f7125efa20dccb8da938bd95cdda1e', NOW() )

     

    MySQL Error: Unknown column 'first_name' in 'field list'

    Date/Time: 10-30-2014 16:18:05

    Array

    (

    [_GET] => Array

    (

    )

     

    [_POST] => Array

    (

    [first_name] => xx

    [last_name] => yy

    => 1@2.com

    [password1] => zzzzzzzzzzz

    [password2] => zzzzzzzzzzz

    [submit] => Register

    )

  6. Hi cracking book by the way, learned loads.

     

    I get an error when I try and register (Chapter 18), the error is:

     

    An error occurred in the script f:\sites\register.php on line 63 query: Insert into users email, pass, first_name, last_name etc etc

     

    It then states :

     

    MYSQL Error : Unknown column 'first_name' in 'field list'

     

    I know the SQL database has this field name correctly spelled the same as the PHP.

     

    Help, spent ages looking?

     

    GY

     

     

×
×
  • Create New...