How should I modify the code?
Thank you in advance!

Code: Select all
function MakeUrl($strUrl)
{
$strText = ' ' . $strUrl;
$strText = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "$1<a href=\"$2\" target=\"_blank\" rel=\"nofollow\">$2</a>", $strText);
$strText = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "$1<a href=\"http://$2\" target=\"_blank\" rel=\"nofollow\">$2</a>", $strText);
$strText = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "$1<a href=\"mailto:$2@$3\" rel=\"nofollow\">$2@$3</a>", $strText);
$strText = substr($strText, 1);
return($strText);
}
Code: Select all
$comments = MakeUrl($comments);
Code: Select all
<input type="hidden" name="nostyled" value="<?php echo $_REQUEST['nostyled']; ?>">
Code: Select all
function styledText($strText)
{
$strText = preg_replace("/\[B\](.*?)\[\/B\]/i","<B>$1</B>",$strText);
$strText = preg_replace("/\[I\](.*?)\[\/I\]/i","<I>$1</I>",$strText);
$strText = preg_replace("/\[U\](.*?)\[\/U\]/i","<U>$1</U>",$strText);
return($strText);
}
Code: Select all
if ($_REQUEST['nostyled'] != "Y") {$comments=styledText($comments);}
Code: Select all
<br>Insert styled text: <a href="Javascript:insertspecial('B')"><b>Bold</b></a> |
<a href="Javascript:insertspecial('I')"><i>Italic</i></a> |
<a href="Javascript:insertspecial('U')"><u>Underlined</u></a><br>
<input type="checkbox" name="nostyled" value="Y"> Disable styled text</p>
Code: Select all
<script language=\"Javascript\" src=\"javascript.js\" type=\"text/javascript\"><!-- //--></script>
Code: Select all
function insertspecial(tag) {
var space=" ";
var text=prompt("Type text you wish to enter:","");
if (text != null)
{
var text_to_insert = space+'['+tag+']'+text+'[/'+tag+']'+space;
insertAtCursor(document.form.comments, text_to_insert);
}
document.form.comments.focus();
}
function insertAtCursor(myField, myValue) {
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}