TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 2,036
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 1013
  • Total: 1013

Unexpected $end error

Started by tattooedpierre, June 22, 2006, 03:59:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tattooedpierre

My site has been down since yesterday and I can't seem to find any reason for it. The error I am receiving is:

Parse error: syntax error, unexpected $end in /home/theinfe/public_html/smf/index.php on line 207

.. upon looking in the index.php file it does seem to be all fine.

<?php
/******************************************************************************
* index.php                                                                   *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com)                *
* =========================================================================== *
* Software Version:           SMF 1.1 RC2                                     *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/

/* This, as you have probably guessed, is the crux on which SMF functions.
Everything should start here, so all the setup and security is done
properly.  The most interesting part of this file is the action array in
the smf_main() function.  It is formatted as so:

'action-in-url' => array('Source-File.php', 'FunctionToCall'),

Then, you can access the FunctionToCall() function from Source-File.php
with the URL index.php?action=action-in-url.  Relatively simple, no?
*/

$forum_version = 'SMF 1.1 RC2';

// Get everything started up...
define('SMF', 1);
@
set_magic_quotes_runtime(0);
error_reporting(E_ALL);
$time_start = microtime();

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');

// And important includes.
require_once($sourcedir . '/QueryString.php');
require_once(
$sourcedir . '/Subs.php');
require_once(
$sourcedir . '/Errors.php');
require_once(
$sourcedir . '/Load.php');
require_once(
$sourcedir . '/Security.php');
// TinyPortal include
require_once($sourcedir . '/TPortal.php');

// Using an old version of PHP?
if (@version_compare(PHP_VERSION, '4.2.3') != 1)
require_once(
$sourcedir . '/Subs-Compat.php');

// If $maintenance is set specifically to 2, then we're upgrading or something.
if (!empty($maintenance) && $maintenance == 2)
db_fatal_error();

// Connect to the MySQL database.
if (empty($db_persist))
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd);
else
$db_connection = @mysql_pconnect($db_server, $db_user, $db_passwd);

// Show an error if the connection couldn't be made.
if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
db_fatal_error();

// Load the settings from the settings table, and perform operations like optimizing.
reloadSettings();
// Clean the request variables, add slashes, etc.
cleanRequest();
$context = array();

// Determine if this is using WAP, WAP2, or imode.  Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.
if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
$_REQUEST['wap2'] = 1;
elseif (isset(
$_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
{
if (
strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
}

if (!
defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));

// Some settings and headers are different for wireless protocols.
if (WIRELESS)
{
define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' : '')));

// Some cellphones can't handle output compression...
$modSettings['enableCompressedOutput'] = '0';
// !!! Do we want these hard coded?
$modSettings['defaultMaxMessages'] = 5;
$modSettings['defaultMaxTopics'] = 9;

// Wireless protocol header.
if (WIRELESS_PROTOCOL == 'wap')
header('Content-Type: text/vnd.wap.wml');
}

// Check if compressed output is enabled, supported, and not already being done.
if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0)
{
// If zlib is being used, turn off output compression.
if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler' || @version_compare(PHP_VERSION, '4.2.0') == -1)
$modSettings['enableCompressedOutput'] = '0';
else
ob_start('ob_gzhandler');
}
// This makes it so headers can be sent!
if (empty($modSettings['enableCompressedOutput']))
ob_start();

// Register an error handler.
set_error_handler('error_handler');

// Start the session. (assuming it hasn't already been.)
loadSession();

// What function shall we execute? (done like this for memory's sake.)
call_user_func(smf_main());

// Call obExit specially; we're coming from the main area ;).
obExit(null, null, true);

// The main controlling function.
function smf_main()
{
global 
$modSettings, $settings, $user_info, $board, $topic, $maintenance, $sourcedir;

// Special case: session keep-alive.
if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
die;

// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();

// Load the current board's information.
loadBoard();

// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
loadTheme();

// Check if the user should be disallowed access.
is_not_banned();

// Load the current user's permissions.
loadPermissions();

// Do some logging if this is not an attachment/avatar or the setting of an option.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption')))
{
// Log this user as online.
writeLog();

// Track forum statistics and hits...?
if (!empty($modSettings['hitStats']))
trackStats(array('hits' => '+'));
}

// TinyPortal
TPortal_init();

// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))
{
// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login2')
{
require_once(
$sourcedir . '/LogInOut.php');
return 
'Login2';
}
// Don't even try it, sonny.
else
{
require_once(
$sourcedir . '/Subs-Auth.php');
return 
'InMaintenance';
}
}
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))
{
require_once(
$sourcedir . '/Subs-Auth.php');
return 
'KickGuest';
}
elseif (empty(
$_REQUEST['action']))
{
// Action and board are both empty... maybe the portal page?
if (empty($board) && empty($topic) && $settings['TPortal_front_type']!='boardindex')
{
require_once(
$sourcedir . '/TPortal.php');
return 
'TPortal';
}
if (empty(
$board) && empty($topic) && $settings['TPortal_front_type']=='boardindex' && (isset($_GET['cat']) || isset($_GET['page'])))
{
require_once(
$sourcedir . '/TPortal.php');
return 
'TPortal';
}


.. anyone have any ideas? I'm using SMF 1.1 RC2 and TP 0.8.6, with various themes installed. It was working fine yesterday morning but now all of sudden this.

I am only aware that yesterday there may have been larger than usual traffic, but other than that..

http://www.theinfernals.org.uk

G6Cad

What did you do when this error first showed up ?

tattooedpierre

I opened the file in question and looked at it. And found nothing on that particular line that was indicative to me of a fault. In the meantime, I checked the SQL database to make sure it was intact.

GTS

Did you paste the content of the whole file to the code block, or just till line 206?

Because, my index.php has a few more lines. (351)

If you pasted the whole file, it means that your index.php is broken.

tattooedpierre

I did paste the whole file, yeah. I thought this might be the case but I couldnt recover a TP'ed version of the index.php file. Do you have any idea where I could get an intact version?

GTS

#5
You could use the SMF original index.php, and apply the changes to it manually.
You can find the needed modifications in TP_mod-instructions.txt in the tinyportal zip file ^^

On the other side, here's mine.
It should only have the changes by the tinypotal mod inside, but no warranty ;)

Edit: damn typos ^^

tattooedpierre

Thanks for that. I do, however, have a new error :(

Warning: Unterminated comment starting line 26 in /home/theinfe/public_html/smf/Sources/Subs.php on line 26

Parse error: syntax error, unexpected $end in /home/theinfe/public_html/smf/Sources/Load.php on line 192


.. everything is looking to be generally messed up :( .. what could do this?!

GTS

#7
Looks like a ploblem with your host, like a crash or something that damaged some files in your folders.
You could try requesting a restore from your host (if the host made backups at least), but that would mean a rollback of serveral days/weeks, depending on the backup interval.

Otherwise, you'll have to reinstall everything, and hope that the database isn't damaged.

Backing up your files regularly helps against that ... ^^

tattooedpierre

I've contacted my host.. Ugh this is a nightmare :( .... sooooo much time and effort spent to create it all. Well at least the database seems to be intact. I'll need to see what they say about a recent crash and recovery options.

Thanks for your help :)

Xarcell

I think the problem is your subs.php. There is an error in the script.

Did you add a mod or something?

This website is proudly hosted on Crocweb Cloud Website Hosting.