Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2012 15:15
Show Gist options
  • Select an option

  • Save anonymous/4277040 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4277040 to your computer and use it in GitHub Desktop.
Chatterbox Extensions.
<?php
header("Content-type: text/plain");
$logfile = "log.txt";
$msg = $_POST['message'];
$contents = file_get_contents($logfile);
if(isset( $_POST['clear'] ) || isset( $_GET['clear'] )) {
file_put_contents($logfile, "");
echo $contents;
} elseif(!isset( $_POST['message'] )) {
echo $contents;
} else {
$contents .= "{$msg}\n";
file_put_contents($logfile, $contents );
echo "OK";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment