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. -
<?
-
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;
-
}
-
}
-
}
-
-
-
?>
-
Anyone got any suggestions - I'm now stumped on this one!
Cheers,
Jay
You should change the name of your function because goto is already a function in php.
4 11822
Hey,
I also have this being called from a "Common" list of functions: -
function goto($location) {
-
-
$tag = "\\";
-
-
if (dirname($_SERVER['SCRIPT_NAME']) == $tag) {
-
$str = "/";
-
} else {
-
$str = dirname($_SERVER['SCRIPT_NAME']);
-
}
-
-
if ($_SERVER['HTTPS'] !== "on") {
-
header('location: http://'.$_SERVER['HTTP_HOST'].$str.'/'.$location);
-
exit();
-
} else {
-
header('location: https://'.$_SERVER['HTTP_HOST'].$str.'/'.$location);
-
exit();
-
}
-
-
}
-
You should change the name of your function because goto is already a function in php.
Thanks JKing, thats spot on, I completely forgot and it came online after 5.2, my new server runs on 5.3.3 so hence the error.
All up and running.
Appreciate your help :-)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: entoone |
last post by:
I'm getting the following error Parse error: parse error, expecting `','' or
`';'' in /home/notarywe/public_html/php/update2.php on line 108
Here is line 108
<input type="text" name="ud_first"...
|
by: Marten van Urk |
last post by:
I got the following error in my page Parse error: parse error,
unexpected T_ELSE in line 25
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Club</title>...
|
by: Ehartwig |
last post by:
I recently created a script for user verification, solved my emailing
issues, and then re-created the script in order to work well with the
new PHP 5 that I installed on my server. After...
|
by: Andrew Ayers |
last post by:
All,
I am having a problem with an INSERT onto a table I have created. First
off, here is the table:
---
CREATE TABLE reg ("customer number" SERIAL PRIMARY KEY, "company name" ...
|
by: Vittal |
last post by:
Hello All,
I am trying to compile my application on Red Hat Linux 8 against gcc
3.2.2.
Very first file in application is failing to compile. I tried
compiling my application on Linux 7.2...
|
by: Brett Romero |
last post by:
I get this error when I try to run my ASP.NET app on our server:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error...
|
by: BWIGLEY |
last post by:
Basically I've just started making a game. So far it makes an array
25 by 20 and tries to make five rooms within it.
In scr_make_room() there's parse errors:
20 C:\c\Rooms\Untitled1.c parse error...
|
by: Phaelle |
last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
What does that error mean? I canīt find the mistake!!
In another script, I have got another kind of mistake : parse...
|
by: badkitty63 |
last post by:
I am getting this error Help!!!!!!
Parse error: syntax error, unexpected T_STRING in /home/desertr3/public_html/includes/languages/english/shipping.php on line 18
I am trying to add shipping...
|
by: fburn |
last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux.
I receive an error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |