c_shelswell Posted January 4, 2008 Share Posted January 4, 2008 I've been given a database that's full of usernames with pretty bad symbols in one such being "&". To verify email addresses we send them a link containing their username then user $_GET to get it back and verify in the database. Problem i have is a user has the "&" sign in their username ie user&user so $_GET is only fetching as far as user Does anyone know a way to get round this?? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/84459-solved-trying-to-get-from-_get/ Share on other sites More sharing options...
Ken2k7 Posted January 4, 2008 Share Posted January 4, 2008 I've been given a database that's full of usernames with pretty bad symbols in one such being "&". To verify email addresses we send them a link containing their username then user $_GET to get it back and verify in the database. Problem i have is a user has the "&" sign in their username ie user&user so $_GET is only fetching as far as user Does anyone know a way to get round this?? Cheers Do you want to prevent the & symbol? You can use preg_match or ereg or eregi or something to check if that symbol is in the username. Quote Link to comment https://forums.phpfreaks.com/topic/84459-solved-trying-to-get-from-_get/#findComment-430273 Share on other sites More sharing options...
rajivgonsalves Posted January 4, 2008 Share Posted January 4, 2008 rawurlencode the username before passing it so "user&user" would become "user%26user" more information on rawurlencode @ http://php.net/rawurlencode Quote Link to comment https://forums.phpfreaks.com/topic/84459-solved-trying-to-get-from-_get/#findComment-430283 Share on other sites More sharing options...
c_shelswell Posted January 4, 2008 Author Share Posted January 4, 2008 Cheers i just thought about doing it with base64_encode but i'll try your rawurlencode first i guess that's made for the job. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/84459-solved-trying-to-get-from-_get/#findComment-430284 Share on other sites More sharing options...
aschk Posted January 4, 2008 Share Posted January 4, 2008 Careful careful my man, some forums have fallen down on using rawurlencode and not properly filtering the information used after that step. Just beware you might be allowing naughty characters through your $_GET string Quote Link to comment https://forums.phpfreaks.com/topic/84459-solved-trying-to-get-from-_get/#findComment-430323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.