Log in

View Full Version : Slashes in names


Boofo
12-07-2002, 03:18 AM
Can someone please tell me how I make this line:

$MessageAddon .= "\nSessions identifys them as ".addslashes($realusername[username]);

Keep from doing this?

Sessions identifys them as Boofo\'s Babe

Xenon
12-07-2002, 11:30 AM
huh?

i think it looks perfect as it is here...

Sparkz
12-07-2002, 12:00 PM
I don't see the problem either.

Boofo
12-07-2002, 04:29 PM
For some reason it parsed it out. Here's how it looks with a space in it (Hopefully it won't parse it with a space). Take the space out between the o and the \ and that's how it looks.

Sessions identifys them as Boofo \'s Babe

Xenon
12-07-2002, 07:30 PM
ahh, ofcourse it does, because you use addslashes function which add's slashes before ' and "

change it into that would help you:
$MessageAddon .= "\nSessions identifys them as ".htmlspecialchars($realusername[username]);

Boofo
12-07-2002, 08:44 PM
Thank you, Stefan. :) I was just using the original code. Why would someone use addslashes instead of specialcharacters then? Or do you have to use addslashes for the db? I have found a few things that don't work well with ' in names on my board. Is there a global fix for that? Just curious more than anything. :)

Xenon
12-07-2002, 08:54 PM
there are differences

specialcharacters changes the string and converts " ' < > and other into html code &lt; and something like that. they show up on the screen equal, but are different strings ;)

addslashes just adds / before ' and " so they could be used inside a string for inserting into db for example

hope it clarifies it :)
it's hard to explain even in my nature language, and harder in english for me ;)

hope it clarifiys

Boofo
12-07-2002, 09:04 PM
So would that be why I get errors when run Counter Updates with Boofo's Babe as the last poster sometimes? I see what you are saying though. Thank you for it explaining it a little better to me. :)

Xenon
12-08-2002, 01:08 PM
hmm, normally it should work, when updating counters....
i've looked into the code, and can't see something wrong..

Boofo
12-08-2002, 01:32 PM
When I had Scott's last title on forumhome installed, it always snagged on that name and gave me a db error. I don't have the hack installed now. I haven't tried the counters since the new install so I may have spoken ahead of myself. Sorry about that. :)