megamanXplosion
Technical User
I have a message board (invision board) and I've successfully modified it so that I can use [script] and [/script] tags to use JavaScript within the posts (Yes I'm aware of security issues, how many times have I been asked that? lol) Anyways, the message board's post_parser.php file automatically converts line breaks into < br> tags, and here is the code that is used to do so....
$txt = preg_replace( "/\n/", "<br>", $txt );
and then there's another similar line which unconverts the linebreaks. I was wondering if someone could tell me how to rewrite that so it'll still replace all of the line breaks, but not those in between [script] and [/script] tags.
If you need an example of what I mean then, here is a simple JavaScript that I would write into a post.
[script]
document.write("Hello"
[/script]
the message board would parse this and output it like this...
<script><br>
document.write("Hello"<br>
</script>
and that would cause errors. Any help would be greatly appreciated
$txt = preg_replace( "/\n/", "<br>", $txt );
and then there's another similar line which unconverts the linebreaks. I was wondering if someone could tell me how to rewrite that so it'll still replace all of the line breaks, but not those in between [script] and [/script] tags.
If you need an example of what I mean then, here is a simple JavaScript that I would write into a post.
[script]
document.write("Hello"
[/script]
the message board would parse this and output it like this...
<script><br>
document.write("Hello"<br>
</script>
and that would cause errors. Any help would be greatly appreciated