Jump to content

Archived

This topic is now archived and is closed to further replies.

Thy Gamer

Striping html?

Recommended Posts

Is there any way I can strip html with out useing, strip_tags($tempinput) ???
It messes up my code for some odd reason,

[code]<?php
$tempinput = "LOL PANTS javascript SELECT * FROM";
SafeGurad($tempinput);

function SafeGurad($tempinput) {
$tempinput = strip_tags($tempinput)
$tempinput = str_replace("%20","","$tempinput");
$tempinput = addslashes("$tempinput");
$tempinput = str_replace("javascript","No_Java_Script_Aloud!","$tempinput");
$tempinput = str_replace("</script>","No_Script_Aloud!","$tempinput");
$tempinput = str_replace("<script>","No_Script_Aloud!","$tempinput");
$tempinput = str_replace("SELECT * FROM","No_SQL_Script_Aloud!","$tempinput");
return $tempinput;
}
Echo $lol;
php?>
[/code]

Share this post


Link to post
Share on other sites
If you really hate strip_tags(), you could replace < and > with &lt's and &gt's. This stops any scripts from running, and any markup from rendering, but doesn't change the appearance.

Share this post


Link to post
Share on other sites
[!--quoteo(post=359831:date=Mar 29 2006, 04:53 PM:name=Cojawfee)--][div class=\'quotetop\']QUOTE(Cojawfee @ Mar 29 2006, 04:53 PM) [snapback]359831[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you really hate strip_tags(), you could replace < and > with &lt's and &gt's. This stops any scripts from running, and any markup from rendering, but doesn't change the appearance.
[/quote]

So something like this?

[code]$tempinput = str_replace("<","&lt","$tempinput");
$tempinput = str_replace(">","&gt","$tempinput");[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=360209:date=Mar 30 2006, 07:27 PM:name=Thy Gamer)--][div class=\'quotetop\']QUOTE(Thy Gamer @ Mar 30 2006, 07:27 PM) [snapback]360209[/snapback][/div][div class=\'quotemain\'][!--quotec--]
So something like this?

[code]$tempinput = str_replace("<","&lt","$tempinput");
$tempinput = str_replace(">","&gt","$tempinput");[/code]
[/quote]


Yep

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.