- Joined
- Apr 30, 2003
- Messages
- 305
- Reaction score
- 1
J/W.
Originally posted by AhmedF
I stay away from javascript ... and use it only for imageovers.
Originally posted by Bob
I also do form validation on the PERL / PH level too.
function safehtml($str) {
//nuke script and header tags and anything inbetween
$str = preg_replace("'<script[^>]*?>.*?</script>'si", "", $str);
$str = preg_replace("'<head[^>]*?>.*?</head>'si", "", $str);
//listed of tags that will not be striped but whose attributes will be
$allowed = "br|b|i|p|u|a|block|pre|center|hr";
//start nuking those suckers. don you just love MS Word's HTML?
$str = preg_replace("/<((?!\/?($allowed)\b)[^>]*>)/xis", "", $str);
$str = preg_replace("/<($allowed).*?>/i", "<\\1>", $str);
return $str;
}
Originally posted by Darren06
I use sessions because then it doesn't store a cookie.
*the exceptional businesses of our esteemed moderators