ok, well i got the replacement thing going here. Don’t know if it’ll work yet since i can’t really test it until i can get it to appear in the textarea. but here’s what i have for code:
[php]
if(isset($_POST[‘Answer’])) {
$id = $_POST[‘id’];
$req_id = $_POST[‘req_id’];
$find = mysql_query("SELECT * FROM venzo_contactus WHERE id = '$id'");
$f = mysql_fetch_assoc($find);
if(!empty($r['last_answered_by'])){
if(strstr($r['last_answered_by'],$_SESSION['adminname'])){
$temp = explode(', ',$r['last_answered_by']);
$temp = array_filter($temp,filterArray);
$str = implode(', ', $temp);
$str .= ', '.$_SESSION['adminname'];
} else {
$str = $f['last_answered_by'].", ".$_SESSION['adminname'];
}
} else {
$str = $_SESSION['adminname']; //Just have it one its own
}
$status = 3;
//for default answer
$uname = $_POST['u_name'];
$aname = $_POST['a_name'];
//replace template variables
$mtemp = explode(" ", $_POST['answer']);
$find = array("%name%", "%admin%");
if(in_array($find, $mtemp)) {
$replace = array($uname, $aname);
$sub = str_replace($find, $replace, $_POST['answer']);
}
if(empty($r['answer'])) {
$ansr = add_slashes_recursive($_POST['n_answer']);
$up = mysql_query("UPDATE venzo_contactus SET last_answered_by = '$str', answer = '$ansr', status = $status WHERE id = $id AND req_id = '$req_id'") or exit(mysql_error());
} else {
$ansr = '\r\n'.add_slashes_recursive($_POST['n_answer']);
$up = mysql_query("UPDATE venzo_contactus SET last_answered_by = '$str', answer = CONCAT(`answer`, '{$ansr}'), status = $status WHERE id = $id AND req_id = '$req_id'") or exit(mysql_error());
//SET message = CONCAT(`message`, '{$mess}'),
}
if($up) {
$suc = $f['subject']." has been successfully updated.<br />An email has been dispatched to ".$f['name'].", notifying the user that their question has been answered.";
$end = 1;
$headers = 'From: [email protected]' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$t = explode("\n", $_POST['n_answer']);
$put = end($t);
//Venzo Support [ID] [Topic]
$sub = "Venzo Support Request ID: ".$f['req_id']."";
$message = "
<html>
<body>
$f[subject] has been replied to by $_COOKIE[adminuser].<br />
Your answer is below:<br />".
strip_slashes_recursive($put)
."<br /><br />
Please use this <a href='http://vmg.venzodigital.com/public_check_inquiries.php?req_id=$req_id'>link</a> to reply.
</body>
</html>";
mail($f['email'], $sub, $message, $headers);
}
}
[/php]