<?php
session_name("e_learning");
session_start();

/**** CHANGE HEADER ****/
if ( isset($_GET['rate']) ) {//' http://www.example.com/'
    header('Location:' . str_replace('&rated_id=' . $_GET['rated_id'], '', str_replace('&rate=' . $_GET['rate'], '', $_SERVER['REQUEST_URI'])));
}

/**** LOGIN: START ****/

include_once('./class/sql.class.php');
include_once('./class/main.class.php');
if ( $_GET['id'] == 3 )
	{
	include_once('./class/reg.class.php');
	$reg = new Reg();
	}
	
echo strpos($_SERVER['REQUEST_URI'], 'praca/');

$sql = new sql(); 	// inicializacia objektu pre pracu s db
$main = new Main();	// inicializacia hlavneho objektu

if ( ( isset($_SESSION['id_user']) && !empty($_SESSION['id_user']) && isset($_POST['logout']) ) && $main->is_logged($_SESSION['id_user']) )
	{
	$main->logout($_SESSION['id_user']);
	$_SESSION = array();
	session_destroy();
	}
elseif ( isset($_POST['login']) && isset($_POST['log_name']) && (trim($_POST['log_name'])!='') && isset($_POST['log_pass']) && (trim($_POST['log_pass'])!='') )
	{
	$main->login($_POST['log_name'], $_POST['log_pass']);
	}
	
if ( !isset($_GET['add']) )
	{
	$_SESSION['uploadnute'] = array();
	}

/**** LOGIN: END ****/
?>

<!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>E-learning project</title>
	<link rel="stylesheet" type="text/css" href="style.css" />
    <link rel="stylesheet" type="text/css" href="rating/star/star_rating.css" />
	<script type="text/javascript" src="mootools/mootools.js"></script>
	<script type="text/javascript" src="mootools/slide/slide.js"></script>
</head>

<body>

<? 
	include('head.php');

	echo '<div class="content">';
		if ( $main->include != '' )
			{
			include($main->include);
			}
	echo '</div>';
?>
</body>
</html>