* No url provided.
";
}
$url=stripslashes($_POST["URL"]);
//Error catching below
if (!filter_var($url,FILTER_VALIDATE_URL)) {
$badpost = true;
$errmsg[] = "* \"$url\" is not a valid ASCII URL.
";
}
if (!empty($_POST["IMG"]) && !filter_var(stripslashes($_POST["IMG"]),FILTER_VALIDATE_URL)) {
$badpost = true;
$errmsg[] = "* Image \"$url\" is not a valid ASCII URL.
";
}
if (!empty($_POST["AUD"]) && !filter_var(stripslashes($_POST["AUD"]),FILTER_VALIDATE_URL)) {
$badpost = true;
$errmsg[] = "* Audio \"$url\" is not a valid ASCII URL.
";
}
if (!isset($_POST["comment"]) || $_POST["comment"] == '') {
$badpost = true;
$errmsg[] = "* Comment is blank.
";
}
if (!$badpost) {
$title = stripslashes($_POST["title"]);
$image = stripslashes($_POST["IMG"]);
$audio = urlencode(stripslashes($_POST["AUD"]));
$audiosrc = stripslashes($_POST["AUD"]);
$comment = stripslashes($_POST["comment"]);
$news2write = "
".$title."";
$news2write = $news2write."";
$news2write = $news2write."
";
if ($image != "") {
$news2write = $news2write."
";
}
if ($audio != "") {
$curlurl = "http://".$_SERVER["SERVER_NAME"]."/".$basedir.$microblog;
$ch = curl_init($cur_url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,false);
$page_content = curl_exec($ch);
$matches = array();
preg_match('/audioplayer_[0-9]*/',$page_content,$matches);
$numfound = count($matches);
$audioinc = $numfound;
++$audioinc;
$news2write = $news2write."Download Audio Here.
";
};
$news2write = $news2write.$comment."
";
$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,$news2write);
fclose($fh);
} else {
print "Could not post due to errors:
";
foreach ($errmsg as $err) {echo $err;}
print "POST Variable Dump below:
";
var_dump($_POST);
print "";
}
} elseif ($_POST["id"] != "") {
if ($_POST["content"] == "") {
$res = unlink($_POST["id"]);
if (!$res) die("ERROR: couldn't delete ".$_POST['id'].", check permissions");
echo "Deleted ".$_POST["id"]."
";
} else {
$fh = fopen($_POST["id"], 'w');
if (!$fh) die("ERROR: couldn't write to ".$_POST['id'].", check permissions");
fwrite($fh,stripslashes($_POST["content"]));
fclose($fh);
echo "Edited ".$_POST["id"]."
";
}
}
?>