require("beheer/db.php");
$extra = "";
$tpl = file_get_contents("tpl.html");
$query =mysql_query("SELECT count(*) as aantal FROM edits WHERE type != 'etcetera'");
$get = mysql_Fetch_object($query);
$aantal = $get->aantal;
if (isset($_GET['id'])) {
$query = mysql_query("SELECT * FROM edits WHERE id = ".intval($_GET['id']));
$get = mysql_fetch_object($query);
} else {
$query = mysql_Query("SELECT * FROM edits WHERE type='koren' ORDER BY rand()");
$get=mysql_fetch_object($query);
}
$query = mysql_query("SELECT * FROM edits WHERE type='koren' AND id !=".$get->id." ORDER BY rand()");
$get2 = mysql_fetch_object($query);
$linknext = 'home.php?id='.$get2->id;
$right = nl2br(stripslashes($get->edit));
$links = "";
if (strlen($get->titel) > 0) {
$links .= "".stripslashes($get->titel)."
";
} else {
$links .= "
";
}
if (strlen($get->door) > 0) {
$links .= "door:
".nl2br(stripslashes($get->door));
} else {
$links .= "
";
}
if (strlen($get->link) > 0) {
$links .= "
link))."\">website";
} else {
$links .= "
";
}
$links .= "
[".$get->nummer."/".$aantal."]";
if ($get->type == 'koren')
$links .= " *";
if (isset($_GET['forceHeader'])) {
$randomfile = $_GET['forceHeader'];
} else {
$files = array();
$hndl = opendir("header/");
while ($file = readdir($hndl)) {
if ($file != '.' && $file != '..' && $file != 'archive') {
$files[] = $file;
}
}
closedir($hndl);
$randomfile = $files[array_rand($files)];
}
$tpl = str_Replace("[randomfile]",$randomfile,$tpl);
$tpl = str_Replace("[linknext]",$linknext,$tpl);
$tpl = str_Replace("[left]",$links,$tpl);
$tpl = str_Replace("[extra]",$extra,$tpl);
$tpl = str_Replace("[right]",$right,$tpl);
echo $tpl;