Hi All,
Wonder if anyone can shed any light on this error I am getting.
I have the following error when trying to access my site:
"Parse error: syntax error, unexpected '(', expecting T_STRING in /dev/lookatme/_config/config.php on line 145"
I've looked at the code again but I can't figure out what is wrong... Here is the code.
Anyone got any suggestions - I'm now stumped on this one!
Cheers,
Jay
Wonder if anyone can shed any light on this error I am getting.
I have the following error when trying to access my site:
"Parse error: syntax error, unexpected '(', expecting T_STRING in /dev/lookatme/_config/config.php on line 145"
I've looked at the code again but I can't figure out what is wrong... Here is the code.
Code:
<?
session_start();
$config = array();
if ((strpos($_SERVER['SERVER_NAME'],'localhost') !== 0) && (strpos($_SERVER['SERVER_NAME'],'192.168.52.132') !== 0)) {
// LIVE SETTINGS
$config['site_url'] = "http://www.mysite.co.uk/dev/lookatme/";
$config['database'] = "mysite_co_uk";
mysql_connect("mysite.co.uk.mysql","mysite_co_uk","L3Tm3Inn") or die("Unable to conn. to database");
@mysql_select_db($config['database']) or die("Unable to select database");
// INI SETS
ini_set('include_path', '_inc/');
// PATH TO SITE ROOT
$config['site_path'] = "";
} else {
// LOCAL SETTINGS
$config['site_url'] = "http://localhost/";
$config['database'] = "localdb";
mysql_connect("localhost","root","12345") or die("Unable to conn. to database");
@mysql_select_db($config['database']) or die("Unable to select database");
// INI SETS
ini_set('include_path', '_inc/');
// PATH TO SITE ROOT
$config['site_path'] = "";
}
// webpage defaults
$webpage = array();
$webpage['id'] = "";
$webpage['sets'] = array();
$webpage['default'] = 0;
$webpage['system'] = 1;
$webpage['versionid'] = "";
$webpage['version_name'] = "";
$webpage['meta_title'] = "";
$webpage['meta_keywords'] = "";
$webpage['meta_description'] = "";
$route = array();
$admin = array();
$admin['id'] = (isset($_SESSION['adminid'])) ? $_SESSION['adminid'] : "" ;
$admin['tab'] = (isset($_SESSION['admintab'])) ? $_SESSION['admintab'] : "" ;
$user = array();
$user['spamprotect'] = (isset($_SESSION['spamprotect'])) ? $_SESSION['spamprotect'] : "" ;
if (isset($_GET['tab'])) {
$admin['tab'] = $_GET['tab'];
$_SESSION['admintab'] = $admin['tab'];
}
// INCLUDES
include("common.php");
include("forms.php");
include("sql_functions.php");
include("emails.php");
include("phpmailer/class.phpmailer.php");
include("generator.php");
include("cms_functions.php");
// DEFAULTS
$default = array();
// GET CONFIG DETAILS
$sql = "
SELECT
*
FROM
core_config
WHERE
active = '1'
";
$result = mysql_query($sql);
$num = mysql_numrows($result);
if ($num > 0) {
$i = 0;
while ($i < $num) {
$key = mysql_result($result,$i,"field");
$value = mysql_result($result,$i,"value");
$config[$key] = $value;
$i++;
}
}
// GET ADMIN DETAILS
if ($admin['id'] != "") {
$sql = "
SELECT
*
FROM
admin_users
INNER JOIN
admin_types ON
admin_users.typeid = admin_types.id
WHERE
admin_users.id='".$admin['id']."'
";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ($num == 0) {
exit();
} else {
$admin['firstname'] = mysql_result($result,0,"firstname");
$admin['surname'] = mysql_result($result,0,"surname");
$admin['typeid'] = mysql_result($result,0,"typeid");
$admin['type'] = mysql_result($result,0,"name");
$admin['email'] = mysql_result($result,0,"email");
}
} else {
$admin['firstname'] = "";
$admin['surname'] = "";
$admin['typeid'] = "";
$admin['type'] = "";
$admin['email'] = "";
}
// SPAM PROTECTION
if ( ($user['spamprotect'] == "") || ( ( (isset($_GET['spamprotect'])) && ($_GET['spamprotect'] == "refresh") ) ) ) {
$user['spamprotect'] = password_return_random(4);
$_SESSION['spamprotect'] = $user['spamprotect'];
}
// HARD CODED ADMIN REDIRECT
function page_requires_admin_login() {
extract($GLOBALS);
if ($admin['id'] == "") {
$msg = "0|Please Log In|You must sign in to view the page you were looking for.";
goto('../index/index.php?msg='.urlencode($msg));
}
}
// ADMIN TYPE REDIRECT
function page_requires_admin_types($requiredtypes) {
if ($requiredtypes != "") {
extract($GLOBALS);
$typearray = explode(",", $requiredtypes);
if (!in_array($admin['typeid'], $typearray)) {
if ($admin['id'] == "") {
$msg = "0|Sign In Required|Sorry, you can not view that page.";
goto('../index/index.php?msg='.urlencode($msg));
} else {
$msg = "0|Access Restricted|Sorry, you do not have access to that page.";
goto('../index/index.php?msg='.urlencode($msg));
}
}
}
}
// HTTP SWITCH
function page_requires_https($v) {
extract($GLOBALS);
if ($config['https_enabled'] == "True") {
if (isset($_SERVER['QUERY_STRING'])) {
$qs = "?".$_SERVER['QUERY_STRING'];
} else {
$qs = "";
}
switch ($v) {
case "1":
// https on
if($_SERVER['HTTPS'] !== "on") {
// redirect here
}
break;
case "0":
// https off
if($_SERVER['HTTPS'] == "on") {
// redirect here
}
break;
case "2":
// do nothing
break;
}
}
}
?>
Cheers,
Jay
Comment