<?php
function rehtmlcode($orimessage) {
	// First convert all linebreaks to <br>
	$message = nl2br($orimessage);
	// Then convert <br> to spaces
	$message = preg_replace('/<br\/?>/', ' ', $message);
	return htmlspecialchars(stripslashes($message), ENT_QUOTES, "UTF-8");
}
function rehtmlcode_nolink($orimessage){
	// convert to unix new lines
	$message= preg_replace("/\r\n|\r|\n/", '', $orimessage);
    $s = array ("<", ">");
    $z = array ("&lt;","&gt;");
    $final = str_replace($s, $z, $message);
    return stripslashes($final);
}
?>