0) { foreach($listing as $msg) { $message = imap_body($mbox, $msg); $arr = explode("\n", $message); // break it up $pagetitle = array_shift($arr); // shift off the first three lines $createdby = array_shift($arr); $introtext = array_shift($arr); $content = implode("\n", $arr); // put the rest of it back together // won't be needed when this is made into a module include "manager/includes/config.inc.php"; $conn = mysql_connect($database_server, $database_user, $database_password) or die(mysql_error()); $db = mysql_select_db(trim($dbase, '`')) or die(mysql_error()); // clean it up $pagetitle = mysql_real_escape_string(trim($pagetitle)); $introtext = mysql_real_escape_string(trim($introtext)); $content = mysql_real_escape_string(trim($content)); $createdby = mysql_real_escape_string(trim($createdby)); // get submitter's ID $sql = "SELECT internalKey FROM " . $table_prefix . "user_attributes WHERE fullname = '$createdby'"; $res = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($res); if($num == 1) { // there had better be one and only one $createdby = mysql_result($res, 0); $sql = "INSERT INTO " . $table_prefix . "site_content (pagetitle, introtext, content, parent, template, createdon, createdby) VALUES ('$pagetitle', '$introtext', '$content', $parent, $template, time(), $createdby)"; mysql_query($sql) or die(mysql_error()); } } }