l104/H17/functions.php

<?php include('../dbpepijn.php'); function ingelogd(){ if(isset($_COOKIE['ingelogd'])){ return true; } else{ return false; } } function id(){ if(ingelogd()){ global $db; $query = "select id from leden where gebruikersnaam = '$_COOKIE[ingelogd]'"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); $row = mysqli_fetch_array($result); return $row['id']; } else{ return null; } } function gebruiker(){ if(ingelogd()){ return $_COOKIE['ingelogd']; } else{ return null; } } function gelezen(){ if (ingelogd()){ global $db; $query = "select count(*) as aantal from berichten where aan = ". id(). " and gelezen = 0"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); $row = mysqli_fetch_array($result); return $row['aantal']; } else{ return null; } } function remove_tags($str, $start, $eind) { while (strpos($str, $start) !== false) { $start_pos = strpos($str, $start); $end_pos = strpos($str, $eind, $start_pos) + strlen($eind); $str = substr_replace($str, "", $start_pos, $end_pos - $start_pos); } return $str; } ?>

Resultaat

Made by Thijs Aarnoudse