Jump to content

Striping html?


Thy Gamer

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]
Link to comment
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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.