\n", str_replace("\"", """, str_replace("<", "<", str_replace("&", "&", remove_escape($strfrom))))); } } function create_replacement_news($news_username, $news_link, $news_content, $news_date, $news_id, $news_html) { $textarea_content = remove_html($news_content, true); if ($news_html) { $is_news_html = "checked"; $news_content = remove_escape($news_content); } else { $news_content = remove_html($news_content); } return "".$news_date." by ".remove_escape($news_username)."
".$news_content.'
Add News | Edit News | Delete News

'; } //if (strtolower($news_username) == "flobi" && md5($news_password) == "79338f7567adbd87a70fdacd50a980e0") { if (md5($news_password) == "") { switch($action){ case "Save This": echo "Editing...(".$news_id.")"; $replacement = create_replacement_news($news_username, $news_link, $news_content, $news_date, $news_id, $news_html); $filename = array_pop(explode("/", $_SERVER["SCRIPT_NAME"])); $cachedfile = file_get_contents($filename) or die("can't get file contents"); $newfile = preg_replace('/<\!\-\-Begin News Item '.$news_id.'\-\->.*<\!\-\-End News Item '.$news_id.'\-\->/s', $replacement, $cachedfile); file_put_contents($filename, $newfile); break; case "Confirm Deletion": echo "Deleting...(".$news_id.")"; $replacement = ""; $filename = array_pop(explode("/", $_SERVER["SCRIPT_NAME"])); $cachedfile = file_get_contents($filename) or die("can't get file contents"); $newfile = preg_replace('/<\!\-\-Begin News Item '.$news_id.'\-\->.*<\!\-\-End News Item '.$news_id.'\-\->/s', $replacement, $cachedfile); file_put_contents($filename, $newfile); ; break; default: echo "Adding...(".$news_nextid.")"; $news_date = date("l, F jS, Y"); $replacement = "\n\n".create_replacement_news($news_username, $news_link, $news_content, $news_date, $news_nextid, $news_html); $filename = array_pop(explode("/", $_SERVER["SCRIPT_NAME"])); $cachedfile = file_get_contents($filename) or die("can't get file contents"); $newfile = str_replace("\n", $replacement, $cachedfile); file_put_contents($filename, $newfile); $old_news_nextid = $news_nextid; $news_nextid++; file_put_contents(array_pop(explode("/", $_SERVER["SCRIPT_NAME"])), str_replace("\$news_nextid = ".$old_news_nextid."; // AUTOUPDATE","\$news_nextid = ".$news_nextid."; // AUTOUPDATE", file_get_contents(array_pop(explode("/", $_SERVER["SCRIPT_NAME"]))))); ; } // switch ?> NEWS:
Add News
Username: 
Password: 
URL for Username Link: 
News: HTML