stripslashes($_POST["title"]), "url" => $url, "image" => stripslashes($_POST["IMG"]), "audio" => stripslashes($_POST["AUD"]), "comment" => stripslashes($_POST["comment"]), "poster" => $poster ); $tdtime = new DateTime(null, new DateTimeZone($timezone)); $today = $tdtime->format('m.d.y'); $now = $tdtime->format('H:i:s'); $newsdir = $_SERVER["DOCUMENT_ROOT"].'/'.$basedir.$microblogdir; @mkdir($newsdir.$today); $fh = fopen($newsdir.$today."/".$now, 'w'); if (!$fh) die("ERROR: couldn't write $newsdir$today/$now to $newsdir$today, check permissions"); fwrite($fh,json_encode($postBody)); fclose($fh); } else {//Print errors at the top, since we didn't have what we needed from POST $message = 'Could not post due to errors:
POST Variable Dump below:
'.print_r($_POST, true).''; echo $message; } } elseif (!empty($_POST["id"])) {//If no title is supplied, let's see if we're editing/deleting a post. if (empty($_POST["content"])) {//BLANKING IN PROGRESS $res = unlink($_POST["id"]); if (!$res) die("ERROR: couldn't delete ".$_POST['id'].", check permissions"); echo "Deleted ".$_POST["id"]."
"; } else {//Attempt editing, first detecting whether content is json $fh = fopen($_POST["id"], 'w'); if (!$fh) die("ERROR: couldn't write to ".$_POST['id'].", check permissions"); if(is_null(json_decode($_POST["content"]))) {$content = stripslashes($_POST["content"]);}//Do some munging if it's just raw text else {$content = $_POST["content"];}//JSON should be formatted correctly already fwrite($fh,$content);//Just write the blob ,TODO validation fclose($fh); echo "Edited ".$_POST["id"]."
"; } } //DOM below ?>

Submissions:

Title
URL
Image
Audio
Comments: