",$text); $text=str_replace("\r","",$text); return ($text); } function gbgetVars($myKey) { // Holt Get-Vars global $HTTP_GET_VARS; if (isset($HTTP_GET_VARS[$myKey])) { if (get_magic_quotes_gpc()) { return (stripslashes($HTTP_GET_VARS[$myKey])); } else { return ($HTTP_GET_VARS[$myKey]); } } else { return (""); } } function gbServerVars($myKey) { // Holt Server-Vars global $HTTP_SERVER_VARS; if (isset($HTTP_SERVER_VARS[$myKey])) { return ($HTTP_SERVER_VARS[$myKey]); } else { return (""); } } function gbfwritePad($fp,$myVar,$length) { // Schreibt gepadded in Datei fwrite($fp,$myVar.str_repeat(" ",$length),$length); } function gbfgetPad($fp,$length) { // Liest gepaddete Daten return rtrim(fread($fp,$length)); } function gbformatText($text) { // Ersetzt BB-Formate $text=str_replace("[i]","",$text); $text=str_replace("[/i]","",$text); $text=str_replace("[b]","",$text); $text=str_replace("[/b]","",$text); $text=str_replace(":)"," ",$text); $text=str_replace(";)"," ",$text); $text=str_replace(":eek:"," ",$text); $text=str_replace(":("," ",$text); $text=str_replace(":o"," ",$text); $text=str_replace(":roll:"," ",$text); $text=str_replace(":lol:"," ",$text); $text.=""; return($text); } $filename="../assets/plugindata/w2dgb438f54ac73e95d55e3a4450e2722b91d.dat"; $maxpage=10; $admin=0; // Daten schreiben if (gbgetVars("action")=="post") { $pos=0; // Position ermitteln if (!file_exists($filename)) { // Neue Datei $fp=fopen($filename,"w"); flock ($fp,2); gbfwritePad($fp,1,6); flock ($fp,3); fclose($fp); $pos=1; $fp=fopen($filename,"r+"); flock ($fp,2); } else { // Anhängen $fp=fopen($filename,"r+"); flock ($fp,2); $pos=gbfgetPad($fp,6); $pos++; fseek($fp,0); gbfwritePad($fp,$pos,6); } // Schreiben fseek($fp,6+($pos-1)*4890); if ($admin) { gbfwritePad($fp,0,1); } else { gbfwritePad($fp,1,1); } gbfwritePad($fp,gbServerVars("REMOTE_ADDR"),15); gbfwritePad($fp,gbpostVars("username"),256); gbfwritePad($fp,substr(gbNLBR(gbpostVars("message")),0,4096),4096); gbfwritePad($fp,gbpostVars("email"),256); gbfwritePad($fp,gbpostVars("www"),256); gbfwritePad($fp, date("d.m.Y"),10); flock ($fp,3); fclose($fp); // Benutzerinterface echo("

Bedankt voor u bericht in ons gastenboek..

\n"); echo("Het gastenboek bekijken

\n"); } if (gbgetVars("action")=="") { // Anzeigen $displaycount=0; if (file_exists($filename)) { $fp=fopen($filename,"r"); flock ($fp,1); $recordcount=gbfgetPad($fp,6); $first=gbgetVars("offset"); if ($first==0) { $first=1; }; $last=$first+$maxpage-1; for ($i=1; $i<=$recordcount; $i++) { fseek($fp,6+($recordcount-$i)*4890); $view=gbfgetPad($fp,1); gbfgetPad($fp,15); if ($view==1) { $displaycount++; if ($i>=$first && $i<=$last) { $username=gbfgetPad($fp,256); $message=gbfgetPad($fp,4096); $email=gbfgetPad($fp,256); $www=gbfgetPad($fp,256); $date=gbfgetPad($fp,10); echo("

"); echo("$date - "); if ($email=="") { echo(htmlentities($username)); } else { echo(""); echo(htmlentities($username)); echo("\n"); } echo("
\n"); echo(gbformatText($message)."

\n"); } } } flock ($fp,3); fclose ($fp); } // Navigation echo("

\n"); echo("Schrijf een nieuw bericht!
\n"); if ($displaycount!=0) { if ($first>1) { print "terug "; }; $page=0; if ($displaycount>$maxpage) { for ($i=1;$i<=$displaycount;$i=$i+$maxpage) { $page++; if ($i==$first) { print " $page "; } else { print "$page "; } } } if ($displaycount>$last) { print "voorruit "; } } echo("

\n"); } if (gbgetVars("action")=="form") { ?>
naam:
E-Mail:
Bericht:
dikgedrukt schuin