Jump to content

how do i? (mabie n00b question)


ccrevcypsys

Recommended Posts

output the code like this:

htmlentities($var);

Where $var is the data from the database

 

EDIT: or strip tags might work better:

strip_tags($var);

 

 

EDIT (again): Then again, if you're only wanting to remove the <style> tags and it's contents try this:

<?php
$var = preg_replace('#(\<style\>)([a-z0-9./:]+)(\<\/style\>)#i', '', $var);
?>

Then again, if you're only wanting to remove the <style> tags and it's contents try this:

<?php
$var = preg_replace('#(\<style\>)([a-z0-9./:]+)(\<\/style\>)#i', '', $var);
?>

 

if you don't want people changing the style definitely strip the tags before they are inputted into your db.  this makes it much easier to deal with displaying later.

 

now if you have certain people  (ie admins, or moderators) that you will allow, you might want to use a different approach.

Then again, if you're only wanting to remove the <style> tags and it's contents try this:

<?php
$var = preg_replace('#(\<style\>)([a-z0-9./:]+)(\<\/style\>)#i', '', $var);
?>

 

if you don't want people changing the style definitely strip the tags before they are inputted into your db.  this makes it much easier to deal with displaying later.

 

now if you have certain people  (ie admins, or moderators) that you will allow, you might want to use a different approach.

what would u recommend because there are going to be the admin and other people that will be able to do this i just don't want other people doing it

Archived

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

×
×
  • 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.