Jump to content

Php errors wont load webpage


Recommended Posts

Hey all, I'm new here at the forum and I'm in bit of a php pickle. :P

 

Any Php Jedis out there willing to aid me?

 

A few months ago I noticed my forum would not load. now I am getting around to reviving it.I received some errors along the lines of something like this:

Notice: Undefined variable: boarddir in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 46

Notice: Undefined variable: sourcedir in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50

Warning: require_once(/QueryString.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50

Fatal error: require_once() [function.require]: Failed opening required '/QueryString.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50

That is what loads when you load the address www.lightworkerawakening.com/forum

 

I'm using Simple Machines Forums I installed through Godaddy's web hosting on a Linux server I believe.

 

Godaddy Support said that it may not be loading the cache properly.

 

here is what those lines actually look like in the index.php file:

45 // Make absolutely sure the cache directory is defined.
46 if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
47  	$cachedir = $boarddir . '/cache';
48
49 // And important includes.
50 require_once($sourcedir . '/QueryString.php');
51 require_once($sourcedir . '/Subs.php');
52 require_once($sourcedir . '/Errors.php'); 

Please help me Obi wan kanobi, you are my only hope :)

 

Link to comment
Share on other sites

The first 2 notices are probably causing the rest of the errors. The 2 variables, $boarddir and $sourcedir, don't exist in your code. Those look like they're supposed to be defined as a path. Then the rest of the code (require's) try to use those variables to load more code, but it can't since the paths aren't defined.

 

So you need to find why those 2 variables aren't defined (should be further up your code), and define them with the correct paths.

Link to comment
Share on other sites

wow I really am a newb, what you just said kind of went over my head.

 

How exactly would I go about defining $boarddir and $sourcedir with the correct paths. I don't know where to even begin, when I stare at the code it doesn't add up yet in my head.

 

Attached is my index.php file, could you possibly take a look and explain to me what to do?

 

Thank your or your reply :)

index.php

Edited by LightWarrior
Link to comment
Share on other sites

For a variable to be used (a variable being $boarddir for instance) then it must hold a value.

 

To give a variable a value, in PHP you can use $boarddir = 'a/path/to/something'; (as an example).

 

The variables you are having issues with ($boarddir and $sourcedir) don't hold any values, therefore you need to give them some - and before the line that then trys to use them later on. Though to be honest, I've basically re-iterated what CroNIX said.

 

As a rule, most of us don't download random files from random strangers...sorry!

Link to comment
Share on other sites

because this was a complete functioning script at one point in time, these two variables were being set somewhere by the code. the current problem is that they are not.  if i remember correctly, there's an installation folder/script for SMF. did you delete this after you installed it so that any random visitor wouldn't have the ability to mess up your installation?

 

you can attempt to find out where these variables should have been set at in the code (i suspect in the Settings.php file) and try to correct the current problem, however it's likely this is just the tip of the iceberg and once you get past this group of errors, there are a bunch more.

 

alternatively, why don't you just download and install the same version of the SMF forum software and start with a known working copy of the software? if you have a good backup of your existing database, you should be able to easily configure a new installation to access the previous data by performing the new install using a different database table prefix from your existing installation, then manually editing the settings to change the prefix to match your previous database tables.

 

trying to make your site whole again, by finding and fixing the cause of each error will take you a while and may never be complete because you would need to test every possible feature to insure you found and fixed everything. staring with a new installation of the software and if necessary reusing existing data would be the surest way of getting the site back working.

  • Like 1
Link to comment
Share on other sites

ok, any idea what kind of values I should give them? what would the code look like?

 

I wouldn't have any idea where to point the variables to make the code happy and pull up my web page again. I'm not sure how this error came to be in the first place. I didn't touch anything.

 

lol, that makes sense not too download files from strangers... wow, mom always said don't take candy from strangers... thats kind of funny to me :)

 

here I will just copy and paste the code from the file that way no downloading will be necessary.

<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0.5
 */

/*	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 2.0.5';

// Get everything started up...
define('SMF', 1);
if (function_exists('set_magic_quotes_runtime'))
	@set_magic_quotes_runtime(0);
error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
$time_start = microtime();

// This makes it so headers can be sent!
ob_start();

// Do some cleaning, just in case.
foreach (array('db_character_set', 'cachedir') as $variable)
	if (isset($GLOBALS[$variable]))
		unset($GLOBALS[$variable], $GLOBALS[$variable]);

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

// Make absolutely sure the cache directory is defined.
if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
	$cachedir = $boarddir . '/cache';

// 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');

// Using an pre-PHP 5.1 version?
if (@version_compare(PHP_VERSION, '5.1') == -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();

// Create a variable to store some SMF specific functions in.
$smcFunc = array();

// Initate the database connection and define some database functions to use.
loadDatabase();

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

// Seed the random generator.
if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
	smf_seed_generator();

// Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
if (isset($_GET['scheduled']))
{
	require_once($sourcedir . '/ScheduledTasks.php');
	AutoTask();
}

// Check if compressed output is enabled, supported, and not already being done.
if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
{
	// 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_end_clean();
		ob_start('ob_gzhandler');
	}
}

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

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

// 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($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
	unset($_SESSION['nowap']);
elseif (isset($_REQUEST['nowap']))
	$_SESSION['nowap'] = true;
elseif (!isset($_SESSION['nowap']))
{
	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');
}

// Restore post data if we are revalidating OpenID.
if (isset($_GET['openid_restore_post']) && !empty($_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]['post']) && empty($_POST))
{
	$_POST = $_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]['post'];
	unset($_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]);
}

// 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, $board_info, $maintenance, $sourcedir;

	// Special case: session keep-alive, output a transparent pixel.
	if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
	{
		header('Content-Type: image/gif');
		die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
	}

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

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

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

	// Attachments don't require the entire theme to be loaded.
	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest']))
		detectBrowser();
	// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
	else
		loadTheme();

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

	// If we are in a topic and don't have permission to approve it then duck out now.
	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
		fatal_lang_error('not_a_topic', false);

	// Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
	if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile')))
	{
		// Log this user as online.
		writeLog();

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

	// 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' || $_REQUEST['action'] == 'logout'))
		{
			require_once($sourcedir . '/LogInOut.php');
			return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
		}
		// 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('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))
	{
		require_once($sourcedir . '/Subs-Auth.php');
		return 'KickGuest';
	}
	elseif (empty($_REQUEST['action']))
	{
		// Action and board are both empty... BoardIndex!
		if (empty($board) && empty($topic))
		{
			require_once($sourcedir . '/BoardIndex.php');
			return 'BoardIndex';
		}
		// Topic is empty, and action is empty.... MessageIndex!
		elseif (empty($topic))
		{
			require_once($sourcedir . '/MessageIndex.php');
			return 'MessageIndex';
		}
		// Board is not empty... topic is not empty... action is empty.. Display!
		else
		{
			require_once($sourcedir . '/Display.php');
			return 'Display';
		}
	}

	// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
	$actionArray = array(
		'activate' => array('Register.php', 'Activate'),
		'admin' => array('Admin.php', 'AdminMain'),
		'announce' => array('Post.php', 'AnnounceTopic'),
		'attachapprove' => array('ManageAttachments.php', 'ApproveAttach'),
		'buddy' => array('Subs-Members.php', 'BuddyListToggle'),
		'calendar' => array('Calendar.php', 'CalendarMain'),
		'clock' => array('Calendar.php', 'clock'),
		'collapse' => array('BoardIndex.php', 'CollapseCategory'),
		'coppa' => array('Register.php', 'CoppaForm'),
		'credits' => array('Who.php', 'Credits'),
		'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'),
		'display' => array('Display.php', 'Display'),
		'dlattach' => array('Display.php', 'Download'),
		'editpoll' => array('Poll.php', 'EditPoll'),
		'editpoll2' => array('Poll.php', 'EditPoll2'),
		'emailuser' => array('SendTopic.php', 'EmailUser'),
		'findmember' => array('Subs-Auth.php', 'JSMembers'),
		'groups' => array('Groups.php', 'Groups'),
		'help' => array('Help.php', 'ShowHelp'),
		'helpadmin' => array('Help.php', 'ShowAdminHelp'),
		'im' => array('PersonalMessage.php', 'MessageMain'),
		'jseditor' => array('Subs-Editor.php', 'EditorMain'),
		'jsmodify' => array('Post.php', 'JavaScriptModify'),
		'jsoption' => array('Themes.php', 'SetJavaScript'),
		'lock' => array('LockTopic.php', 'LockTopic'),
		'lockvoting' => array('Poll.php', 'LockVoting'),
		'login' => array('LogInOut.php', 'Login'),
		'login2' => array('LogInOut.php', 'Login2'),
		'logout' => array('LogInOut.php', 'Logout'),
		'markasread' => array('Subs-Boards.php', 'MarkRead'),
		'mergetopics' => array('SplitTopics.php', 'MergeTopics'),
		'mlist' => array('Memberlist.php', 'Memberlist'),
		'moderate' => array('ModerationCenter.php', 'ModerationMain'),
		'modifycat' => array('ManageBoards.php', 'ModifyCat'),
		'modifykarma' => array('Karma.php', 'ModifyKarma'),
		'movetopic' => array('MoveTopic.php', 'MoveTopic'),
		'movetopic2' => array('MoveTopic.php', 'MoveTopic2'),
		'notify' => array('Notify.php', 'Notify'),
		'notifyboard' => array('Notify.php', 'BoardNotify'),
		'openidreturn' => array('Subs-OpenID.php', 'smf_openID_return'),
		'pm' => array('PersonalMessage.php', 'MessageMain'),
		'post' => array('Post.php', 'Post'),
		'post2' => array('Post.php', 'Post2'),
		'printpage' => array('Printpage.php', 'PrintTopic'),
		'profile' => array('Profile.php', 'ModifyProfile'),
		'quotefast' => array('Post.php', 'QuoteFast'),
		'quickmod' => array('MessageIndex.php', 'QuickModeration'),
		'quickmod2' => array('Display.php', 'QuickInTopicModeration'),
		'recent' => array('Recent.php', 'RecentPosts'),
		'register' => array('Register.php', 'Register'),
		'register2' => array('Register.php', 'Register2'),
		'reminder' => array('Reminder.php', 'RemindMe'),
		'removepoll' => array('Poll.php', 'RemovePoll'),
		'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'),
		'reporttm' => array('SendTopic.php', 'ReportToModerator'),
		'requestmembers' => array('Subs-Auth.php', 'RequestMembers'),
		'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'),
		'search' => array('Search.php', 'PlushSearch1'),
		'search2' => array('Search.php', 'PlushSearch2'),
		'sendtopic' => array('SendTopic.php', 'EmailUser'),
		'smstats' => array('Stats.php', 'SMStats'),
		'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'),
		'spellcheck' => array('Subs-Post.php', 'SpellCheck'),
		'splittopics' => array('SplitTopics.php', 'SplitTopics'),
		'stats' => array('Stats.php', 'DisplayStats'),
		'sticky' => array('LockTopic.php', 'Sticky'),
		'theme' => array('Themes.php', 'ThemesMain'),
		'trackip' => array('Profile-View.php', 'trackIP'),
		'about:mozilla' => array('Karma.php', 'BookOfUnknown'),
		'about:unknown' => array('Karma.php', 'BookOfUnknown'),
		'unread' => array('Recent.php', 'UnreadTopics'),
		'unreadreplies' => array('Recent.php', 'UnreadTopics'),
		'verificationcode' => array('Register.php', 'VerificationCode'),
		'viewprofile' => array('Profile.php', 'ModifyProfile'),
		'vote' => array('Poll.php', 'Vote'),
		'viewquery' => array('ViewQuery.php', 'ViewQuery'),
		'viewsmfile' => array('Admin.php', 'DisplayAdminFile'),
		'who' => array('Who.php', 'Who'),
		'.xml' => array('News.php', 'ShowXmlFeed'),
		'xmlhttp' => array('Xml.php', 'XMLhttpMain'),
	);

	// Allow modifying $actionArray easily.
	call_integration_hook('integrate_actions', array(&$actionArray));

	// Get the function and file to include - if it's not there, do the board index.
	if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']]))
	{
		// Catch the action with the theme?
		if (!empty($settings['catch_action']))
		{
			require_once($sourcedir . '/Themes.php');
			return 'WrapAction';
		}

		// Fall through to the board index then...
		require_once($sourcedir . '/BoardIndex.php');
		return 'BoardIndex';
	}

	// Otherwise, it was set - so let's go to that action.
	require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]);
	return $actionArray[$_REQUEST['action']][1];
}

?>
Link to comment
Share on other sites

Hi again,

 

As mac_gyver has pointed out you'd be better doing a re-install of the forum (read their post for more detail), however mac_gyver also mentioned that there is a file being included that contains the settings (i.e. the variables) required by the forum to run. In the pasted code, it is probably this line

 

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

 

If you have a look at that file (Settings.php) you will probably find where the variables you are looking for are assigned their values.

 

Regards the downloading of random files, I didn't actually realise it was being hosted on phpfreaks.com itself - which definitely makes it a little more trustworthy :-)

 

You could post the Settings.php page here...with db passwords etc obscured... and somebody maybe will be able to help.BUT you are strongly advised to take mac_gyver's advice.

 

Good luck.

Edited by wezhind
Link to comment
Share on other sites

Wow, so I did take mac_gyvers advise... I installed a fresh forum at lightworkerawakening.com/testforum to compare and contrast the difference.

 

It turns out somehow all the code in my settings.php file doesn't exist anymore. it is completely blank when I open it. How on Earth that happened I have no idea.

 

So that must be the issue because the fresh copy of SMF, the settings.php file is full of code.

 

Now I am in a dilemma as it turns out i did not save the database password when I initially created the forum over a year ago.

 

I am trying to save the data that was in the forum, posts, topics, categories, customizations etc. so I don't have to start over again

 

Is there a way to recover that database password or perhaps a back up of the forum from an earlier date one could roll back to? 

 

I could copy the the fresh SMF setting,php and just edit the paths to match my existing install. but looks like I need that db password :/

 

I'm gonna hop back on the phone with Godaddy and see what they say

Edited by LightWarrior
Link to comment
Share on other sites

A little progress made...

 

I managed to reset the password for the database and I edited the paths in the fresh copy of settings.php to match the data and new pw for my existing forum. I then uploaded to the lightworkerawakening.com/forum directory

 

The errors are now gone, but for some reason it wont allow me to connect to the database.

 

The webage now loads this message:

 

 

Connection Problems Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.

 

I have changed the password twice now.

 

Any thoughts?

 

here is what my settings.php file now looks like

<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance = 0;		# Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)
$mtitle = 'Maintenance Mode';		# Title for the Maintenance Mode message.
$mmessage = 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!';		# Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname = 'Light Worker Awakening';		# The name of your forum.
$language = 'english';		# The default language file set for the forum.
$boardurl = 'http://lightworkerawakening.com/forum';		# URL to your forum's folder. (without the trailing /!)
$webmaster_email = '******************gmail.com';		# Email address to send emails from. (like noreply@yourdomain.com.)
$cookiename = 'SMFCookie665';		# Name of the cookie to set for authentication.

########## Database Info ##########
$db_type = 'mysql';
$db_server = 'lig1333602415582.db.7556421.hostedresource.com';
$db_name = 'lig1333602415582';
$db_user = 'lig1333602415582';
$db_passwd = '************';
$ssi_db_user = '';
$ssi_db_passwd = '';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = '/home/content/21/7556421/html/LightWorkerAwakening.com/forum';		# The absolute path to the forum's folder. (not just '.'!)
$sourcedir = '/home/content/21/7556421/html/LightWorkerAwakening.com/forum/Sources';		# Path to the Sources directory.
$cachedir = '/home/content/21/7556421/html/LightWorkerAwakening.com/forum/cache';		# Path to the cache directory.

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error = 0;


# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
	$boarddir = dirname(__FILE__);
if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources'))
	$sourcedir = $boarddir . '/Sources';
if (!file_exists($cachedir) && file_exists($boarddir . '/cache'))
	$cachedir = $boarddir . '/cache';

?> 
Edited by LightWarrior
Link to comment
Share on other sites

Are all of your db tables prefixed with 'smf_'?

 

You might also try changing the driver to "mysqli" instead of "mysql".

 

It looks like you should be receiving emails about the db errors ($db_error_send = 1;)...are you?

 

You might contact the host then if db_server, db_name, db_user and db_passwd are all correct, and everything else.

 

In the future when reinstalling or upgrading something, make a copy of the original so you have the original files to compare to.

Link to comment
Share on other sites

I would not know if the db_tables are prefixed with smf or what exactly that would mean.

 

under line 28 I changed $db_type = 'mysql'; to $db_type = 'mysqli'; with no difference. I have changed it back to 'mysql'

 

Yes I did receive the emails regarding the error. 

 

As far as I know the the db_server, db_name, db_user and db_passwd are all correct.

 

I logged into my filezilla and discovered a folder on my root called "db_backups"

 

contained inside is a "lig1333602415582.final.sql" from 5/15/2014

 

I believe that may be a working configuration. 

 

how would I go about restoring it?

dbbackup_zpsceb4a69c.png

Link to comment
Share on other sites

the backup file you found is a database backup. that won't necessarily help you.

 

how exactly are you changing the database password? i suspect you will need to perform a 'flush privileges' to get any changes to the database username/password to take effect.

 

edit: i would create a small .php script with database connection logic in it, with connection error checking and reporting and get it to work first with the correct database and username/password before bothering with the SMF script.

 

edit2: as to how your Settings.php file got cleared, one likely way is through the SMF software itself. you must always keep your software up to date with the latest patches/revisions. since this is opensource code and a popular script, it's easier to discover a security hole in it and then that information is quickly spread over the internet. 

Link to comment
Share on other sites

Hi again, I think you should follow the advice regards creating a small connection script and then mess about with that until you actually get the connection...then transfer the correct details (once found) to the SMF forum code/settings.

 

However, regards using the 'mysql' option instead of 'mysqli', I would advise going with the latter as the mysql option is likely to be deprecated very soon, whereas 'mysqli' won't.

 

Good luck.

 

edit: p.s. I find it a little peculiar that the db_name and the db_user are the same...(I'm not saying they aren't correct - it just seems weird)

Edited by wezhind
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.