include("../includes/common.htm");
$limit=50;
$networktable="lerage_network";
if (($fid) && ($status=='add')) {
if ($mypost!='') {
//$mypost=ereg_replace("\'","\\'",$mypost);
$mypost=preg_replace("/\'/","/\\'/",$mypost);
//$mypost = stripcslashes ($mypost);
$insert="insert into $networktable (pid,pjob,MyPost,`date`) values ('$fid','$job','$mypost','$current_datetime')";
$insertrec = mysql_query("$insert") or $msg="Unable to insert post, contact admin.
";
print mysql_error(). "
";
if ($insertrec!='') { $msg="Post successfully entered.
Click on your posted message to edit."; }
} else { $msg="Empty Post"; }
}
if (($fid) && ($delid!='')) {
$delete="delete from $networktable where id='$delid' and pid='$fid'";
$deleterec = mysql_query("$delete") or $msg="Unable to remove post, contact admin.
";
if ($deleterec!='') { $msg="Post successfully removed."; }
}
if (($fid) && ($status=='edit')) {
$mypost=str_replace("
","",$mypost);
$mypost=str_replace("<\p>","",$mypost);
$mypost=trim($mypost);
if ($mypost!='') {
$mypost=ereg_replace("\'","\\'",$mypost);
$update="update $networktable set MyPost='$mypost' where id='$pid' and pid='$fid'";
} //else { $update="delete from $networktable where id='$pid' and pid='$fid'"; }
//print "$update";
$updaterec = mysql_query("$update") or $msg="Unable to edit post, contact admin.
";
if ($updaterec!='') { $msg="Post successfully edited."; }
}
if (!$fid) {
$error="You must be a member to post message.
Login | Register";
}
if (($fid) && ($pid)) {
$qry="select MyPost from $networktable where id='$pid' and pid='$fid'";
$rec=SelectQry($qry);
$title="Edit Post or Remove Post";
$status="edit";
} else { $title="Add new post"; $status="add"; }
?>