Location: PHPKode > projects > vuBB Community Forums > includes/settings.php
<?php
/**
 * vuBB
 * Copyright 2005-2006 the vuBB Group
 *
 * http://www.vubb.com/
 * http://community.vubb.com/
 */

// Have we been asked to logout?
if (isset($_GET['logout']) && $_GET['logout'] == 'yes')
{
	logout();
	header("Location: ".makeurl('index'));
}

// Cookies.
set_cookie();
check_cookie();

// Connect to database.
database_connect($database['server'], $database['username'], $database['password'], $database['dbname']);

// Fetch configuration.
$config_querya = mysql_query("SELECT `name`, `value` FROM `config`"); 

$site_config = array(); 
while ($carray = mysql_fetch_array($config_querya)) 
{ 
	if ($carray['name'] == 'site_url')
	{
		$carray['value'] = str_replace(' ', '%20', $carray['value']);
	}
	$site_config[$carray['name']] = $carray['value']; 
}

// Fetch portal configuration.
$config_queryb = mysql_query("SELECT `name`, `value` FROM `portal_config`"); 
     
$portal_config = array(); 		
while ($carray = mysql_fetch_array($config_queryb)) 
{ 
	$portal_config[$carray['name']] = $carray['value']; 
}

// We have no use for these anymore.
unset($config_querya, $config_queryb);

// Breadcrumb.
$breadcrumb = '<a href="'.makeurl('index').'">Index</a>';

// Language.
include(ROOT.'language/' . $site_config['language'] . '.php');

// Templates.
include(ROOT.'includes/templating.php');


// Session.
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SESSION['user']) && isset($_SESSION['pass']))
{
	$stat = mysql_fetch_array(mysql_query("SELECT * FROM `members` WHERE `user` = '".$_SESSION['user']."' AND `pass` = '".$_SESSION['pass']."'")); 
	
	// Log the `no` user out.
	if (!$stat['user'])
	{
		logout();
	}
	
	mysql_query("UPDATE `members` SET `ip` = '".$ip."' WHERE `user` = '".$stat['user']."'");
	lock_checker();
}
else
{
	$stat = mysql_fetch_array(mysql_query("SELECT * FROM `members` WHERE `id` = '-1'")); 
}
// Date information.
$fadyt = date("H:i:s"); // Time format.
$fadyd = date("F j, y"); // Date format.
$absolutetime = time();

// Expanding/Collapsing states. Runs through the cookie array.
$vubbcollapse = array(
	'toggleimg_foruminfo_online' => '',
	'toggleobj_foruminfo_online' => '',
	'toggleimg_foruminfo_stats' => '',
	'toggleobj_foruminfo_stats' => ''
);
if (!empty($_COOKIE['vubb_collapse']))
{
	$val = preg_split('#\n#', $_COOKIE['vubb_collapse'], -1, PREG_SPLIT_NO_EMPTY);
	foreach ($val AS $key)
	{
		$vubbcollapse["toggleobj_$key"] = 'display:none;';
		$vubbcollapse["toggleimg_$key"] = '_collapsed';
		$vubbcollapse["togglecel_$key"] = '_collapsed';
	}
	unset($val);
}
?>
Return current item: vuBB Community Forums