Jump to content


Photo

Striping html?


  • Please log in to reply
3 replies to this topic

#1 Thy Gamer

Thy Gamer
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 29 March 2006 - 09:47 PM

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

<?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?>


#2 Cojawfee

Cojawfee
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 29 March 2006 - 09:53 PM

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.

#3 Thy Gamer

Thy Gamer
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 31 March 2006 - 12:27 AM

[!--quoteo(post=359831:date=Mar 29 2006, 04:53 PM:name=Cojawfee)--][div class=\'quotetop\']QUOTE(Cojawfee @ Mar 29 2006, 04:53 PM) View Post[/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?

$tempinput = str_replace("<","&lt","$tempinput");
$tempinput = str_replace(">","&gt","$tempinput");


#4 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 31 March 2006 - 01:32 AM

[!--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) View Post[/div][div class=\'quotemain\'][!--quotec--]
So something like this?

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


Yep




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users