Get back there dumbass!!\n"; } else { // Before we get the MySQL connection open, get the date and time // as well as the posted scoop... $time_epoch = time(); $date_str = date("j F Y", $time_epoch); $time_str = date("h:i:s A", $time_epoch); $body = $_POST["news"]; // Now escape any special characters that will fuck up MySQL. $body = preg_replace("/\r/", "", $body); $body = preg_replace("/'/", "\'", $body); // Good to go. Open up MySQL and then insert. $mysql_connect_string = "/home/waskiewicz.org/etc/mysql_connect_string"; $fp = fopen($mysql_connect_string, "r"); $username = fgets($fp, 4096); $password = fgets($fp, 4096); fclose($fp); $username = chop($username); $password = chop($password); $link = mysql_connect("localhost", $username, $password) or die("Could not connect to MySQL!!"); // Select the database mysql_select_db("pj_web", $link); mysql_query("INSERT into pj_newstable (id, date, body, time) VALUES (NULL, '$date_str', '$body', '$time_str')") or die ("INSERT query on pj_newstable died: " . mysql_error()); mysql_close($link); print "Post News
The news has been added.


Click here to go home.\n"; } ?>