<?
session_start();

include "include/db_connect.php";
include "include/functions_sql.php";
include "include/tables.php";
include "include/menu.php";
include "include/functions_www.php";
include "include/functions_display.php";

include "public/connection.php";
include "public/home.php";
include "public/videos.php";
include "public/members.php";
include "admin/admin_home.php";
include "public/contacts.php";

// define user right and id if new session
if (!$_SESSION["user_right"])
  $_SESSION["user_right"] = 0;

if (!$_SESSION["user_id"])
  $_SESSION["user_id"] = 0;

// if user is blacklisted redirect it
if ($_SESSION["user_right"] == -1) {
  go_random_blacksite();
  return;
 }

// if user is logged and not use https, disconnect it!
if ($_SERVER['HTTPS'] != "on" && $_SESSION["user_id"] > 0)
  userDisconnect();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EPTV</title>
<link rel="icon" type="image/vnd.microsoft.icon" href="images/eptv.ico" />
<style type="text/css" media="screen" title="Style par defaut">
@import url(css/main.css);
</style>
</head>

<?
if ($_GET['connect']) {
  $connect_tv = $_GET['connect'];
  if ($connect_tv == 1)
      checkUser($_POST['user_login'], $_POST['user_pass']);
  else if ($connect_tv == -1)
    userDisconnect();
 }
?>

<body>
<basefont face="lucida">
<div id="main_container">
    <!-- header and top menu -->
    <div id="main_header_home">
        <div id="menu_left"></div>
        <div id="menu_right"></div>
        <? dispMenu(); ?>
    </div>


	<?
		/*if ($_SESSION["user_right"] > 0)
			echo '<img src="images/logo_up_green_xmas.jpg" width="100%" height="105">';
		else
			echo '<img src="images/logo_up_red_xmas.jpg" width="100%" height="105">';
		*/
	?>


	<?
		if ($_GET['section'])
			$section_www = $_GET['section'];
		else
			$section_www = "Home";

		$tab_section[$section_www]($_GET['action']);
	?>

</div>
<div id="main_footer">
	<div id="foot_menu">
		<ul>
			<li><a href="http://www.epita.fr" title="Site Epita">EPITA</a></li>
			<li><a href="http://www.epitech.net" title="Site Epitech">EPITECH</a></li>
		</ul>
	</div>
	<div id="ft_img_left"></div>
	<div id="ft_img_mid"></div>
	<div id="ft_img_right"></div>
	<p class="copyrights"><br>&copy; 2010 EPTV<br /><br /><br /></p>
</div>
</body>
</html>
