Parse error help
I am getting this message after uploading a site to the remote server:
Parse error: syntax error, unexpected '{' in /home/content/w/i/l/wildfelid/html/scripts/user_authentication.php on line 9
I cannot find any syntax problem and was hoping other eyes might see something I haven't been able to.
This is the user_authentication.php code:
<?php
$failed = FALSE;
if ($_POST) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$failed = TRUE;
} else {
require_once('library.php');
// check the user's credentials
try {
$auth = Zend_Auth::getInstance();
$adapter = new Zend_Auth_Adapter_DbTable($dbRead, 'users', 'username', 'password');
$adapter->setIdentity($_POST['username']);
$adapter->setCredential($_POST['password']);
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$storage = $auth->getStorage();
$storage->write($adapter->getResultRowObject(array(
'username', 'first_name', 'last_name')));
header('Location: members_only.php');
exit;
} else {
$failed = TRUE;
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
if (isset($_GET['logout'])) {
require_once('library.php');
try {
$auth = Zend_Auth::getInstance();
$auth->clearIdentity();
} catch (Exception $e) {
echo $e->getMessage();
}
}
The library.php connection file used by the above file looks like this:
<?php
// Adjust the path to match the location of the library folder on your system
$library = '/home/content/w/i/l/wildfelid/html/library/ZendFramework/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
try {
Zend_Loader_Autoloader::getInstance();
$write = array('host' => 'p50mysql15.secureserver.net',
'username' => 'username',
'password' => 'password',
'dbname' => 'wildfelid');
$read = array('host' => 'p50mysql15.secureserver.net',
'username' => 'usernameRead',
'password' => 'password',
'dbname' => 'wildfelid');
$dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
} catch (Exception $e) {
echo $e->getMessage();
}
Usernames and passwords have been changed to protect the innocent. These may look familiar to some as based on lessons in David Powers' DW CS5 with PHP book. Unfortunately David seems occupied elsewhere right now. Any help would be greatly appreciated.
Peter
