View Full Version : I am a bit new to PHP and...


bejayel
02-03-2003, 04:11 AM
first off in my chat (umm it isnt up on my site yet, i am jut talking about tests) every time someone write a " in my php chat the browser automatically put a \ infront of it when the person posts it. how can i get rid of this?

e.g.
person writes
"i love to talk"

turns out
\"i love to talk\"

so help greatly appreciated. and one more thing, what is the PHP code for transforming text into smilies? i have tried many differant things but i just cant get it to work right. thanks.

Also Does anyone know how to automatically parse url's? that people post on my guestbook? (also still not up on my site)
i am just asking first before i put everything up.

pb&j
02-03-2003, 05:41 AM
For the quotes...
http://www.php.net/manual/en/function.stripslashes.php

For the smilies and the URL, it would probably be a matter of search and replace sortof thing.

bejayel
02-03-2003, 08:11 AM
yeah i still dont get how to use it. i will ask on my flatface forums.

Ökii
02-03-2003, 10:33 AM
for the quotes - that's a feature set in the php.ini called magic_quotes. If you have access to your ini file, or if your host allows scripts to dictate their own settings, you could just switch it off

magic_quotes_gpc, "off"

and handle all the addslashes and stripslashes yourself. More work, more control though.

As to the URLs and smileys - I'd reckon a regex 'preg_replace' for the url (might take a while to learn regexing tho) and a simpler array match - replace for the smilies