A
Anonymous
Guest
I am trying to use some scripts from a book by Larry Ullman 'PHP 6 and MySQL 5' for user registration and login, but I am finding that the config.inc.php script errors on the following line:
I am running this on a localhost with a virtual Host called 'logintest'.
The line produces the following error:
Can anyone see the error?
Here is the full script:
Many thanks!
Code:
echo '<div class="error">' . $message . '</div><br />';
The line produces the following error:
I have not a clue why this is in error!Parse error: syntax error, unexpected 'class' (T_CLASS), expecting ',' or ')' in D:\wamp\www\LoginTest\includes\config.inc.php on line 50
Can anyone see the error?
Here is the full script:
Code:
<?php # Script 16.3 - config.inc.php
/* This script:
* - define constants and settings
* - dictates how errors are handled
* - defines useful functions
*/
// Document who created this site, when, why, etc.
// ********************************** //
// ************ SETTINGS ************ //
// Flag variable for site status:
define('LIVE', FALSE);
// Admin contact address:
define('EMAIL', 't.e.hudson@btinternet.com');
// Site URL (base for all redirections):
define ('BASE_URL', 'http://localhost/');
// Location of the MySQL connection script:
define ('MYSQL', 'D:\wamp\www\LoginTest\');
// Adjust the time zone for PHP 5.1 and greater:
date_default_timezone_set("Europe/London");
// ************ SETTINGS ************ //
// ********************************** //
// ****************************************** //
// ************ ERROR MANAGEMENT ************ //
// 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(j-n-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 { // Do not show the error:
// Send an email to the admin:
mail(EMAIL, 'Site Error!', $message, 'From: email@example.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');
// ************ ERROR MANAGEMENT ************ //
// ****************************************** //
?>