Index: example_wall.php
===================================================================
--- example_wall.php (revision 59)
+++ example_wall.php (working copy)
@@ -3,11 +3,12 @@
// the world's least efficient wall
function add_line($msg) {
- global $REMOTE_ADDR;
$f = fopen("/tmp/wall.html", "a");
$dt = date("Y-m-d h:i:s");
- fwrite($f, "$dt $msg
\n");
+ $msg = strip_tags($msg);
+ $remote = $_SERVER["REMOTE_ADDR"];
+ fwrite($f, "$dt $msg
\n");
fclose($f);
}
@@ -17,7 +18,7 @@
while (!feof($f))
$lines[] = fgets($f, 8192);
// return the last 15 lines
- return join("\n", array_slice($lines, - 15));
+ return join("\n", array_slice($lines, -25));
}
rs_init();
@@ -37,32 +38,36 @@
function refresh_cb(new_data) {
document.getElementById("wall").innerHTML = new_data;
document.getElementById("status").innerHTML = "Checked";
+ setTimeout("refresh()", 1000);
}
function refresh() {
document.getElementById("status").innerHTML = "Checking..";
x_refresh (refresh_cb);
- setTimeout("refresh()", 2500);
}
function add_cb() {
// we don't care..
}
-
+
function add() {
var line;
+ var handle;
+ handle = document.getElementById("handle").value;
line = document.getElementById("line").value;
- x_add_line(line, add_cb);
+ x_add_line("[" + handle + "] " + line, add_cb);
document.getElementById("line").value = "";
- refresh();
}