<?php
if(isset($_GET["source"])){highlight_file($_SERVER["SCRIPT_FILENAME"],false);return;}

include 
"func.save.php";
$data load("data.inc");
define("buffer"5);
if(isset(
$_POST['user'])){
    if(
trim($_POST['user']) == "") die("Everybody haz a name!!! <a href='?page=write'>Go Back</a>");
    if(
trim($_POST['text']) == "") die("You typed nothing!!! <a href='?page=write'>Go Back</a>");
    
//filtering
    
$blocked = array("fuck""shit");
    
$replacewith = array("frak""shazbot");
    
$user str_replace($blocked$replacewith$_POST['user']);
    
$text str_replace($blocked$replacewith$_POST['text']);
    
$data[] = array("user"=>stripslashes(htmlspecialchars($userENT_QUOTES)), "text"=>stripslashes(htmlspecialchars($textENT_QUOTES)));
    
save("data.inc"$data);
    
header("Location: ./?page=added");
    die();
}

if(isset(
$_GET['page'])){
    if(
$_GET['page'] == "added"){
        die(
"Your message was added! <a href='?page=write'>Add another on</a>");
    }

    if(
$_GET['page'] == "read"){
    
$display array_shift($data);
    if(
$display != NULL){
        
save("data.inc"$data);
        
$output $display['user']." : ".$display['text'];
        
//messages to go count (comment it out if you want)
        
$output .=     " (".count($data).")";
    } else{
        
$output ="Nothing to display!";
    }

    echo <<<EOS
    <html>
    <head>
    <meta http-equiv="refresh" content="10">
    </head>
    <body bgcolor="#000000" text="#ffffff">
    <div style="font-size:500%; font-family:courier new; font-weight:bold;">
    $output
    </div>
    </body>
    </html>
EOS;
    die();
    }

    if(
$_GET['page'] == "write"){
    echo <<<EOS
        <form method="POST">
            Name : <br /><input name='user'><br />
            Message : <br /><textarea name='text'></textarea><br />
            <input type='submit' value='Add2Q'>
        </form>
EOS;
        die();
    }
}
?>
<iframe src="?page=write" height=200 width=300 frameborder=1></iframe>

<iframe src="?page=read" height=500 width=600 frameborder=1></iframe>