<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 4/30/2010
// Modified: 12/2/2010	Ed Lemmers
// Changed relative path to index.php to absolute path to fix problem of infinite loop back to index.php in kfm folder.
// Revised: 2/7/2012	ELL
// Added table prefix handling.
//
	session_start();
	$userid = $_SESSION['userid'];
	$curr_session = md5(session_id());
	
	include ("../connect/db_connection.php");
	include ("../connect/config.php");
	
	$query = "SELECT `Session`, `IP`, `AccessLevel` FROM `" . BWB_TABLE_PREFIX . "users` WHERE `UserID`='$userid'";
	$result = mysql_query($query, $bwb_link);
	$row = mysql_fetch_array($result);
	
	$session = $row['Session'];
	$ip = $row['IP'];
	$access_level = $row['AccessLevel'];
	$curr_ip = $_SERVER['REMOTE_ADDR'];
	
	if (($curr_session != $session) || ($curr_ip != $ip))
		header("Location: /index.php");
?>