Code:
<?php
function SetVars($db,$tabel,$result){
$veld = mysql_list_fields($db,$tabel);
$kol = mysql_num_fields($veld);
while($item = @mysql_fetch_array($result)){
for($i=0;$i<$kol;$i++){
$temp = mysql_field_name($veld,$i);
$$temp = $item[$temp];
echo("$temp - ".$$temp."<br>");
}
}
}
function spliting($char, $string, $tabel){
$platform = "";
$array = explode($char, $string);
for($k=0;$k<count($array);$k++) {
$temp = $array[$k];
$qu_kijk = "SELECT * FROM $tabel WHERE id=$temp";
$rs_kijk = mysql_query($qu_kijk);
if($tabel=='vl_kijkwijzer'){
while($item_kijk = @mysql_fetch_array($rs_kijk)){
$output .= "<a href='javascript:kijk()'><img src='../images/kijkwijzer/".$item_kijk['pic_icon']."' alt='" . $item_kijk['pic_icon'] . "' border=0></a>";
}
}else{
while($item_kijk = @mysql_fetch_array($rs_kijk)){
$platform .= $item_kijk['naam'].", ";
}
}
}
if($tabel != 'vl_kijkwijzer'){
$output .= substr($platform,0,-2);
}
return $output;
}
function print_pages($db,$tabel,$result,$page,$cat,$search)
{
$max_items = 15;
$field = mysql_list_fields($db,$tabel);
$rec_count = mysql_num_rows($result);
$num_fields = mysql_num_fields($field);
$page_count = ceil($rec_count/$max_items);
if(!$page || $page<0 || $page>$page_count){
$page=0;
}
$first_item = $page*$max_items;
$last_item = $max_items;
$tot = $first_item+$max_items;
$output .= "<table border=0 width='100%' cellspacing=0 cellpadding=0>";
if($page_count>1){
$output .= "<tr><td align='left' valign='middle' width='20%'>";
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige</a> ";
}else{
$output .= "";
}
$output .= "</td><td align='center' valign='middle' width='60%'>";
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='txtNormal'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
$output .="</td><td align='right' valign='middle' width='20%'>";
if($page<$page_count-1){
$next_page = $page+1;
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}else{
$output .= "";
}
$output .="</td></tr><tr><td colspan=3>";
$output .="<hr noshade size='1' color='#ffffff'><br>";
}
switch($cat){
case "vl_regisseur":
if($rec_count==0){
$output .="<p class='txtNormal'>Geen resultaten gevonden<p>";
}else{
$qu_acteur = "SELECT DISTINCT id, naam FROM vl_regisseur WHERE naam LIKE '%" . $search . "%' ORDER BY naam LIMIT $first_item,$last_item";
$rs_acteur = mysql_query($qu_acteur);
while($rc_acteur = mysql_fetch_array($rs_acteur)){
$output .="<a href='../php/person.php?categorie=$cat&zoek=" . $rc_acteur['id'] . "' target='_self'>" . $rc_acteur['naam'] . "</a><br>";
}
}
break;
case "vl_acteur":
if($rec_count==0){
$output .="<p class='txtNormal'>Geen resultaten gevonden<p>";
}else{
$qu_acteur = "SELECT DISTINCT id, naam FROM vl_acteur WHERE naam LIKE '%" . $search . "%' ORDER BY naam LIMIT $first_item,$last_item";
$rs_acteur = mysql_query($qu_acteur);
while($rc_acteur = mysql_fetch_array($rs_acteur)){
$output .="<a href='../php/person.php?categorie=$cat&zoek=" . $rc_acteur['id'] . "' target='_self'>" . $rc_acteur['naam'] . "</a><br>";
}
}
break;
case "vl_item_games":
if($rec_count==0){
$output .="<p class='txtNormal'>Geen resultaten gevonden<p>";
}else{
while($rc_game = mysql_fetch_array($result)){
$output .="<a href='../php/item_game.php?id=" . $rc_game['id'] . "' target='_self'>" . $rc_game['titel'] . "</a><br>";
}
}
break;
default:
$qu_titel = "SELECT * FROM $tabel where $cat LIKE '%$search%' ORDER BY titel ASC LIMIT $first_item,$last_item" ;
//echo($qu_titel);
$rs_titels = mysql_query($qu_titel);
if($rec_count==0){
$output .="<p class='txtNormal'>Geen resultaten gevonden<p>";
}else{
while($item = @mysql_fetch_array($rs_titels)){
for($j=0;$j<$num_fields;$j++){
$temp = mysql_field_name($field,$j);
$$temp = $item[$temp];
}
$output .="<a href='../php/item.php?id=$id' target='center'>" . ucfirst($titel) . "</a> <span class='txtNormal'>(" . $jaar . ", plaats: " . $plaats . ")<br>";
}
}
break;
}
$output .="</td></tr></table>";
return($output);
}
function print_persons($db,$tabel,$result,$page,$cat,$search)
{
$max_items = 15;
$field = mysql_list_fields($db,$tabel);
$rec_count = mysql_num_rows($result);
$num_fields = mysql_num_fields($field);
$page_count = ceil($rec_count/$max_items);
if(!$page || $page<0 || $page>$page_count){
$page=0;
}
$first_item = $page*$max_items;
$last_item = $max_items;
$tot = $first_item+$max_items;
$output .= "<table border=0 width='100%' cellspacing=0 cellpadding=0>";
if($page_count>1){
$output .= "<tr><td align='left' valign='middle' width='10%'>";
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige</a> ";
}else{
$output .= "";
}
$output .= "</td><td align='center' valign='middle' width='80%'>";
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='txtNormal'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
$output .="</td><td align='right' valign='middle' width='10%'>";
if($page<$page_count-1){
$next_page = $page+1;
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}else{
$output .= "";
}
$output .="</td></tr><tr><td colspan=3>";
}
$output .="<hr noshade size='1' color='#ffffff'><br>";
if($cat=='vl_regisseur'){
$qu_titel = "SELECT * FROM $tabel where cbo_regisseur='$search' ORDER BY titel ASC LIMIT $first_item,$last_item" ;
$rs_titels = mysql_query($qu_titel);
}else if($cat=='vl_acteur'){
$qu_titel = "SELECT * FROM $tabel where cbo_acteur1='$search' OR cbo_acteur2='$search' OR cbo_acteur3='$search' OR cbo_acteur4='$search' OR cbo_acteur5='$search' ORDER BY titel ASC LIMIT $first_item,$last_item" ;
$rs_titels = mysql_query($qu_titel);
}else{
$qu_titel = "SELECT * FROM $tabel where $cat LIKE '%$search%' ORDER BY titel ASC LIMIT $first_item,$last_item" ;
$rs_titels = mysql_query($qu_titel);
}
if($rec_count==0){
$output .="<p class='txtHeaderFilm'>Geen resultaten gevonden<p>";
}else{
while($item = @mysql_fetch_array($rs_titels)){
for($j=0;$j<$num_fields;$j++){
$temp = mysql_field_name($field,$j);
$$temp = $item[$temp];
}
$output .="<a href='../php/item.php?id=$id' target='center'>" . ucfirst($titel) . "</a> <span class='txtNormal'>($jaar)<br>";
}
}
$output .="</td></tr></table>";
return($output);
}
function parseSiteText($text){
$text = nl2br(htmlspecialchars($text));
$text = str_replace("[hr]","<hr>",$text);
$text = str_replace("", "<b>",$text);
$text = str_replace("", "</b>",$text);
$text = str_replace("","<i>",$text);
$text = str_replace("","</i>",$text);
$text = str_replace("","<u>",$text);
$text = str_replace("","</u>",$text);
$text = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\1</a>",$text);
$text = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$text);
$text = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]", "<img src=\"\\1\">",$text);
$text = eregi_replace("\\[img_left\\]([^\\[]*)\\[/img_left\\]", "<img src=\"\\1\" align=\"left\">",$text);
$text = eregi_replace("\\[img_right\\]([^\\[]*)\\[/img_right\\]", "<img src=\"\\1\" align=\"right\">",$text);
return $text;
}
function print_persons2($db,$tabel,$result,$page,$cat,$search)
{
$max_items = 15;
$field = mysql_list_fields($db,$tabel);
$rec_count = mysql_num_rows($result);
$num_fields = mysql_num_fields($field);
$page_count = ceil($rec_count/$max_items);
if(!$page || $page<0 || $page>$page_count){
$page=0;
}
$first_item = $page*$max_items;
$last_item = $max_items;
$tot = $first_item+$max_items;
$output = "<p class='txtHeaderFilm'>Zoekresultaten $first_item tot $tot</p>";
$output .= "<table border=0 width='100%' cellspacing=0 cellpadding=0>";
if($page_count>1){
$output .= "<tr><td align='center' valign='middle'>";
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige </a>";
}else{
$output .= " ";
}
$output .= "</td><td align='center' valign='middle'> ";
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='nr'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
$output .= "</td><td align='center' valign='middle'>";
if($page<$page_count-1){
$next_page = $page+1;
$output .="<a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}else{
$output .= " ";
}
$output .="</td></tr><tr><td colspan=3>";
}
$output .="<hr><br>";
$qu_titel = "SELECT * FROM $cat WHERE naam LIKE '%$search%' ORDER BY naam ASC LIMIT $first_item,$last_item";
$rs_titels = mysql_query($qu_titel);
if($rec_count==0){
$output .="<p class='txtHeaderFilm'>Geen resultaten gevonden</p>";
}else{
while($item = @mysql_fetch_array($rs_titels)){
for($j=0;$j<$num_fields;$j++){
$temp = mysql_field_name($field,$j);
$$temp = $item[$temp];
//echo("$temp - ".$$temp."<br>");
}
$output .="<a href='../php/person.php?categorie=$cat&zoek=".$item['id']."&naam=".$item['naam']."' target='_self'>".$item['naam']."</a><br>";
}
}
$output .="<br><br>";
$output .="</td></tr><tr><td align='center' valign='middle'>";
if($page_count>1){
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige</a></td><td align='center' valign='middle'>";
}
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='nr'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
if($page<$page_count-1){
$next_page = $page+1;
$output .=" </td><td align='center' valign='middle'><a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}
}
$output .="</td></tr></table>";
return($output);
}
function print_games($db,$tabel,$result,$page,$cat,$search){
$max_items = 15;
$field = mysql_list_fields($db,$tabel);
$rec_count = mysql_num_rows($result);
$num_fields = mysql_num_fields($field);
//return($rec_count);
$page_count = ceil($rec_count/$max_items);
if(!$page || $page<0 || $page>$page_count){
$page=0;
}
$first_item = $page*$max_items;
$last_item = $max_items;
$tot = $first_item+$max_items;
//echo("Eerste: ".$first_item);
$output = "<p class='txtHeaderFilm'>Zoekresultaten $first_item tot $tot</p>";
$output .= "<table border=0 width='100%' cellspacing=0 cellpadding=0>";
if($page_count>1){
$output .= "<tr><td align='center' valign='middle'>";
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige</a> </td><td align='center' valign='middle'>";
}
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='nr'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
if($page<$page_count-1){
$next_page = $page+1;
$output .="</td><td align='center' valign='middle'><a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}
$output .="</td></tr><tr><td colspan=3>";
}
$output .="<br><br>";
$qu_titel = "SELECT * FROM $tabel where titel LIKE '%$search%' ORDER BY titel ASC LIMIT $first_item,$last_item" ;
$rs_titels = mysql_query($qu_titel);
if($rec_count==0){
$output .="<p class='txtHeaderFilm'>Geen resultaten gevonden<p>";
}else{
while($item = @mysql_fetch_array($rs_titels)){
for($j=0;$j<$num_fields;$j++){
$temp = mysql_field_name($field,$j);
$$temp = $item[$temp];
//echo("$temp - ".$$temp."<br>");
}
$output .="<a href='../php/item_game.php?id=$id' target='center'>$titel</a> <span class='txtNormal'>($jaar) - ";
$qu_genre = "SELECT * FROM vl_genre_games WHERE id=$cbo_genre_games";
$rs_genre = mysql_query($qu_genre);
while($item_genre = @mysql_fetch_array($rs_genre)){
$output .= $item_genre['naam'];
}
$output .= " - " ;
$platform = "";
$array = explode('&|&', $chb_drager);
for($k=0;$k<count($array);$k++) {
$temp = $array[$k];
$qu_kijk = "SELECT * FROM vl_drager_games WHERE id=$temp";
$rs_kijk = mysql_query($qu_kijk);
while($item_kijk = @mysql_fetch_array($rs_kijk)){
$platform .= $item_kijk['naam'].",";
}
}
$output .= substr($platform,0,-1);
$output .=" - $plaats </span><br>";
}
}
$output .="<br><br>";
$output .="</td></tr><tr><td align='center' valign='middle'>";
if($page_count>1){
if($page>0){
$prev_page = $page-1;
$output .= "<a href='". $_SERVER['PHP_SELF'] ."?page=$prev_page&categorie=$cat&zoek=$search' target='_self'>Vorige</a> </td><td align='center' valign='middle'>";
}
for($i=1; $i<=$page_count; $i++){
$page_num = $i-1;
if($i==$page+1){
$output .=" <span class='nr'>$i</span>";
}else{
$output .=" <a href='". $_SERVER['PHP_SELF'] ."?page=$page_num&categorie=$cat&zoek=$search' target='_self'>$i</a>";
}
}
if($page<$page_count-1){
$next_page = $page+1;
$output .="</td><td align='center' valign='middle'><a href='". $_SERVER['PHP_SELF'] ."?page=$next_page&categorie=$cat&zoek=$search' target='_self'>Volgende</a>";
}
}
$output .="</td></tr></table>";
return($output);
}
function getScoreAsStars($score){
$output = "";
for($i=0; $i<floor($score/2); $i++){
$output .= "<img src='../images/site/goldstar.gif'>";
}
if($score%2 == 1){
$output .= "<img src='../images/site/goldgreystar.gif'>";
}
for($i=0; $i<floor((10-$score)/2); $i++){
$output .= "<img src='../images/site/greystar.gif'>";
}
return $output;
}
?>