Jump to content

Membership site


jaymundaka

Recommended Posts

Hi all.

New to all this business (I say new, it's my first site but seems like it's taken forever.).

I've tried various methods to lock up some pages and whichever scripts I use, at the end, the pages are viewable and I get the message "A system error occurred. We apologize for the inconvenience.".

 

this is the verify script

 

<?php

 

// Flag variable for site status:

define('LIVE', TRUE);

 

// Admin contact address:

define('EMAIL', '1stoptutorials@gmail.com');

 

// Site URL (base for all redirections. This is the address they will be redirected to if they try to access a protected page and they are not logged in.):

define ('BASE_URL', 'http://www.1stoptutorials.com/member/login_form.html');

 

// Location of the MySQL connection script:

define ('MYSQL', 'db.php');

 

 

// Create the error handler:

function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {

 

// Build the error message.

$message = "<p>An error occurred in script '$e_file' on line $e_line: $e_message\n<br />";

 

// Add the date and time:

$message .= "Date/Time: " . date('n-j-Y H:i:s') . "\n<br />";

 

// Append $e_vars to the $message:

$message .= "<pre>" . print_r ($e_vars, 1) . "</pre>\n</p>";

 

if (!LIVE) { // Development (print the error).

 

echo '<div class="error">' . $message . '</div><br />';

 

} else { // Don't show the error:

 

// Send an email to the admin:

mail(EMAIL, 'Site Error!', $message, 'From: you@youremail.com');

 

// Only print an error message if the error isn't a notice:

if ($e_number != E_NOTICE) {

echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div><br />';

}

} // End of !LIVE IF.

 

} // End of my_error_handler() definition.

 

// Use my error handler.

set_error_handler ('my_error_handler');

 

 

?>

 

 

and this is the top and bottom bits for the page

 

<?php

require_once ('verify.php');

$page_title = 'YOUR PAGE TITLE GOES HERE';

 

// Start output buffering:

ob_start();

 

// Initialize a session:

session_start();

 

// Check for a $page_title value:

if (!isset($page_title)) {

$page_title = 'User Registration';

}

 

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

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

 

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

ob_end_clean(); // Delete the buffer.

header("Location: $url");

exit(); // Quit the script.

 

}

?>

 

 

<?php // Flush the buffered output.

ob_end_flush();

?>

 

 

I just spotted the bit that says "$page_title = 'YOUR PAGE TITLE GOES HERE';"

It's not as simple as putting the page name is there is it? It wasn't mentioned in any of the tutorials..

 

Thanks

Dean

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.