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