File: /home/awaldron/public_html/aw/spelling-bee/iknowit.php
<?php
$filename = 'iknowit.txt';
$somecontent = $_GET['w']."\n";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>