<?php 
include("index.php");

session_start();
$sid = session_id();

//$dbid = mysql_connect("localhost","root","");
$dbid = mysql_connect(":/tmp/mysql50.sock","matosimi_websupport_sk","3094jt093");
if ($dbid == FALSE) {
	die(mysql_error());
	echo "Coudln't connect to database!";
	exit();
}
mysql_select_db("matosimi_websupport_sk",$dbid);

//check validity content parametra
$content = isset($_GET['content']) ? $_GET['content']: "mojv";
$result = mysql_query("SELECT * FROM content WHERE code = '$content' ORDER BY id DESC;", $dbid);
if (mysql_num_rows($result) == 0) {
	echo "Content not found!";
	exit();
}

//prilinkovanie funkcii
include_once("atariweb_lib.php");

//initdown($dbid); - aktualizovanie liniek downloadov v databaze

//DOWNLOAD
if (isset($_GET['download'])) 
		$file = download($_GET['download'], $dbid);
	

//OVLADANIE FUNKCII GUESTBOOK-U
if ($_GET['content'] == 'book') {
	//delete post
	if (isset($_GET['deletepost']))
		$message = deletepost($_GET['deletepost'], $sid, $dbid);
	
	//add post
	if (isset($_POST['calc'])) 
		$message = addpost($_POST, $sid, $dbid);
}

?>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>MatoSimi.atari.org :: <?php echo mysql_result($result, 0, 'title'); ?>
  </title>


  <meta http-equiv="content-type" content="text/html;charset=windows-1250" />

  <link rel="stylesheet" href="CSS/atariweb.css" type="text/css" />

</head>

<body>

<!-- Generated at www.csscreator.com -->
<div id="container">
	<div id="banner">
		<img src="title.png" alt="LOGO" />
		<h1>ultimate 8-bit atari site</h1>

	</div>

	<div id="outer">
		<div id="inner">
			<div id="left">
			<?php 
			$c0nt3nt_allowed = true;
			include("c0nt3nt/".(($_GET['lang'] == 'en')? 'en/' : '')."menu.php");
				?> 
			</div>

			<div id="content">
				<?php 
				
				include("c0nt3nt/".(($_GET['lang'] == 'en')? 'en/' : '').mysql_result($result, 0, 'file')); ?>
			<br clear="all" /> 
			</div>

<!-- end content -->
		 </div>

<!-- end inner -->
	 </div>

<!-- end outer -->
	<div id="footer">
		<h1>designed by <a href="mailto:matosimi(_AT_)centrum.sk">MatoSimi</a> 2006</h1>

	</div>

</div>

<!-- end container -->
</body>
</html>
