Jump to content

String help


mike1313

Recommended Posts

I have a chat script and everytime the user enters an html tag that isnt <B><I><U><S> it returns as a blank message. Using strip_tags($message, '<B><U><I><S>');

 

So if I entered <TD> it would display as blank and screw the whole page layout up.

 

Any ideas on how I could fix this? Any help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/79013-string-help/
Share on other sites

Yeah but that's not feasible because I'd have to use it for every single tag that isn't font related.

 

Is there a way to make a variable to where it searches for a tag <TD> for example and if its in the string to put a </TD> automatically at the end?

Link to comment
https://forums.phpfreaks.com/topic/79013-string-help/#findComment-399839
Share on other sites

It could search and using strpos put the </td> right next to it, but as far as putting it 'at the end', well, PHP would ahve no idea where 'the end' is assuming the end would be the end of some string. If you can narrow 'the end' down to the next white-space, next period, next whatever, then PHP could put it there.

 

If you're building a chat environment, you might want to implement BBCode style tags for users to use. It's much better suited for what you are apparently doing. There have been many discussions around here, so search the forum.

 

PhREEEk

Link to comment
https://forums.phpfreaks.com/topic/79013-string-help/#findComment-399845
Share on other sites

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.