slashes and html in messages

Locked
Sub_Zero
Forum Newbie
Posts: 15
Joined: Thu Jan 11, 2007 12:19 pm
ID: 0
Location: Norway

slashes and html in messages

Hey

You have a bug in your message system.....

The recieved message shows slashes and screwed up html codes....

The solution is to add this to the code:

Code: Select all

$message = htmlentities(stripslashes($message));


That's all...
Last edited by Sub_Zero on Thu Jan 11, 2007 7:59 pm, edited 1 time in total.

Image

Trade feedback thread
Ingame ID: 68803
vn70072
Forum Irregular
Posts: 475
Joined: Thu Oct 13, 2005 12:49 pm
ID: 0
Location: The edge of the abyss

Interesting. Still, it's been funny like that since I started. I wonder if it was just considered too minor to bother with or something.
The way of the warrior is the path of shadow
The gift of the warrior is to perceive that which cannot be seen
The spirit of the warrior is to strike in a single moment
The destiny of the warrior is balance in all things
And when balance is lost, all that is left...
Is the Reckoning.
Sub_Zero
Forum Newbie
Posts: 15
Joined: Thu Jan 11, 2007 12:19 pm
ID: 0
Location: Norway

Yeah, it's not that it's very important, but can be annoying sometimes, and it is easy to fix.

For example if you are posting an ingame nick or alliance name with a special character like ™ or Ω, not to mention the slashes infront of an aphostrophe or quotation mark ;)

Image

Trade feedback thread
Ingame ID: 68803
RobinInDaHood
Forum Elite
Posts: 1509
Joined: Wed Oct 25, 2006 3:39 am
Race: Vulpes
ID: 75697
Location: Da Hood, of course

Re: slashes and html in messages

Sub_Zero wrote:Hey

You have a bug in your message system.....

The recieved message shows slashes and screwed up html codes....

The solution is to add this to the code:

Code: Select all

$message = htmlentities(stripslashes($message));


That's all...


It would be nice if you'd also do the following:

Code: Select all

$message = str_replace("\n", "<br>", $message);


That would maintain newlines in the messages and not run everything together into one contiguous line. This line would have to be inserted after the htmlentities() call above otherwise the <br> tags would be rendered as text.
Legoless
Fledgling Forumer
Posts: 181
Joined: Sat Jan 07, 2006 3:51 am
Alliance: ArvYStaTe.net
Race: Developer

Or just use phpBB BBCode class and everything is solved. ;)
Inferno™
Suspended
Posts: 492
Joined: Sun May 14, 2006 8:27 am
ID: 0

Re: slashes and html in messages

RobinInDaHood wrote:
Sub_Zero wrote:Hey

You have a bug in your message system.....

The recieved message shows slashes and screwed up html codes....

The solution is to add this to the code:

Code: Select all

$message = htmlentities(stripslashes($message));


That's all...


It would be nice if you'd also do the following:

Code: Select all

$message = str_replace("\n", "<br>", $message);


That would maintain newlines in the messages and not run everything together into one contiguous line. This line would have to be inserted after the htmlentities() call above otherwise the <br> tags would be rendered as text.


Its fixed so paragraphs are now possible. Dont you use the message system?
RobinInDaHood
Forum Elite
Posts: 1509
Joined: Wed Oct 25, 2006 3:39 am
Race: Vulpes
ID: 75697
Location: Da Hood, of course

Re: slashes and html in messages

Inferno™ wrote:Its fixed so paragraphs are now possible. Dont you use the message system?


Actually, not much because of its limitations. If what you're saying is correct, it's a step in the right direction of making a more usable tool.
Sub_Zero
Forum Newbie
Posts: 15
Joined: Thu Jan 11, 2007 12:19 pm
ID: 0
Location: Norway

Re: slashes and html in messages

It would be nice if you'd also do the following:

Code: Select all

$message = str_replace("\n", "<br>", $message);


That would maintain newlines in the messages and not run everything together into one contiguous line. This line would have to be inserted after the htmlentities() call above otherwise the <br> tags would be rendered as text.


Going into details, I obviously forgot to mention that the htmlentities function also replaces the "<" and ">" in tags, so the line:

Code: Select all

$message = htmlentities(stripslashes($message));


has to be placed before any nl2br() function call, eg. remove any existing nl2br() call and do this:

Code: Select all

$message = str_replace("\n", "<br />\n",htmlentities(stripslashes($message)));


Which would maintain the newlines and not corrupt the tags into html text.

Image

Trade feedback thread
Ingame ID: 68803
Locked

Return to “Bugs Archive”