PDA

View Full Version : <a href="this is a format problem">"'"'</a>


kenny873
05-22-2003, 09:48 AM
if I insert <a href='http://www.cnn.com> Without closing quote </a>

my code will die and as you may see from the above code, what I want to do is

1) if I have a ' before http:// , it will turn into htmlspecialchars

2) how do i count/extract everything within [URL.....[/URL] ?


another question....

I have a hidden code that will embedded with with user's message, say if the user type "hello", it acutally is

"<!--DO NOT REMOVE THIS## <B> date()--> hello <!--DO NOT REMOVE THIS ## </B>-->"

and the whole thing will be inserted into the database

i want to remove everything EXCEPT "hello"
when the USER want to "EDIT" the message....

how can I do that?

missing-score
05-23-2003, 07:43 AM
[URL] [ /URL]

<?php

$url = "http://www.futuremb.co.uk";

$url = preg_replace("/\[url=(.*)\](.*)\[\/url\]/i", "<a href=\"$1\">$2</a>", $url);

// Only a basic example. ^^^


$article = "<!-- do not remove whatever...... --> my article <!-- dont remove -->";

// I cant remember if ! and - are meta, so I will unescape them. You may have to remove some \\ s.

$article = preg_replace("/\\<\\!\\-\\- do not remove (.*) \\-\\-\\>(.*)\<\\!\\-\\- do not remove (.*) \\-\\-\\>/ise", "$1", $article);

?>

kenny873
05-23-2003, 08:35 AM
thx!~~