I need help with a script. It was supposed to write the string'blog.push(new Post(' . $_REQUEST['body'] . ', new Date(' . $_REQUEST['date'] . ')));/*\n*/'to the file blog.js, but it doesn't work. It just shows a blank page. If anyone could give me a replacement script, I'd be grateful.
But if anyone could debug the script below (of course I removed the username and password), I would also be grateful:
PHP Code:<?php
function fileappend($txt, $filename, FILE_APPEND) {
//Write to the blog file
$append = file_put_contents($filename, $txt);
if ($append)
echo 'File written...<br />';
else
die('Error writing file!<br />');
}
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$loggedin = (strtolower($username) == /*username not shown*/) && ($password == /*Password not shown*/);
if ($loggedin) {
fileappend('blog.push(new Post(' . $_REQUEST['body'] . ', new Date(' . $_REQUEST['date'] . ')));/*\n*/', 'blog.js');
} else
echo "Sorry, login failed.<br />";
?>

