jaymundaka Posted October 26, 2010 Share Posted October 26, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.