PDA


View Full Version : new member - special html chars


otto
05-07-2003, 03:30 PM
i cant remember what you put for the code on another thing, but anyhow...

on the welcome panel, it says:

Welcome our newest member, >Geneva<

which goes to >Geneva<

so there u are...

otto

Tigga
05-07-2003, 03:50 PM
Thanks Otto. Just had to add unhtmlspecialchars around the part that pulls the name. ;)

dr00
05-27-2003, 12:10 AM
i'm so confused!!!

Tigga
05-27-2003, 01:04 AM
It's rather simple actually. When a user signs up for a name with special HTML characters (such as &, >, ", etc) it uses the htmlspecialchars function to to insert them into the database as their HTML counter parts (&amp, &gt, &quot, etc). This is to prevent a user from using malicious HTML code that could potentially mess up the way a page is displayed, or worse (this same function is also used when posting, editing your profile, and etc). Then later when this information is pulled from the database, it would normally still have the counterpart displayed instead of the normal character. However, vBulletin has made it's own unhtmlspecialchars function which will remove this coding to have it displayed properly, mostly using the preg_replace and str_replace functions to convert these. That function will also remove the forwardslashes that are added in front of ' characters, which is necessary to make sure information can be inserted into the database properly and won't give an error. Did that clear everything up for you dr00? :D

Tigga
05-27-2003, 01:07 AM
Hrmmm... Why is it converting the HTML code into the normal characters? I don't think it's supposed to do that... Well nevermind. It works on vBulletin 2.x, but doesn't seem to on vB3.0... Oh well, I changed the post above so it will show them properly. :)

dr00
05-29-2003, 06:36 AM
*starts dr00ling on self* i... dont.... understand..... :twitch:










:p