NSW42 Posted March 27, 2007 Share Posted March 27, 2007 Heya, im all new to php mysql but getting there, im stuck with a issue on !reg, what mine does with this (!ereg("^[A-za-z0-0-9]+$",$_POST[nickname])) it checks the data base ok for all nick names, but what im having trouble with is, i have assic nicknames, so the actual name gets inserted into the db like this Pεpşı™ but if someone joins it tells them to Enter a Valid nickname with letters and numbers only, i know its saying the correct thing as the (!ereg("^[A-za-z0-0-9] is for plain names only, if anyone can help out with a ireg that allows the assic would be much appreciated.. Thanks to anyone that can help Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/ Share on other sites More sharing options...
monk.e.boy Posted March 27, 2007 Share Posted March 27, 2007 are you sure it is the regular expression that is making your data go funny in the DB? Are you using utf8 everywhere? monk.e.boy Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215890 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Author Share Posted March 27, 2007 everything is fine, they can change there nickname once there in chat to assic, its just when they joinup, it just says incorrect valid, if i take out the checke and ereg they can joinup with any nickname, but then that presents a problem with it not checking the db for nickname being available or in use. Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215893 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Author Share Posted March 27, 2007 everything is fine, they can change there nickname once there in chat to assic, its just when they joinup, it just says incorrect valid, if i take out the checke and ereg they can joinup with any nickname, but then that presents a problem with it not checking the db for nickname being available or in use. on registeration it tells u if nickname is taken, but if its available it just comes up with use valid nickname with letters and numbers only. Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215898 Share on other sites More sharing options...
DeathStar Posted March 27, 2007 Share Posted March 27, 2007 Post your if statement for it please. Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215909 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Author Share Posted March 27, 2007 if(!ereg("^[A-za-z0-9]+$",$nickname)) { print("Enter a Valid nickname with letters and numbers only.<BR>"); Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215917 Share on other sites More sharing options...
monk.e.boy Posted March 27, 2007 Share Posted March 27, 2007 Post both the 'add new' and 'change' nickname code. Thanks. monk.e.boy Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215925 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Author Share Posted March 27, 2007 thats my other issue, i have not put in a checkn in the change nickname script as yet, until i get this 1st part sorted out as i know that i will end up with the same issue and no one will be able to change there nickname. Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215933 Share on other sites More sharing options...
monk.e.boy Posted March 27, 2007 Share Posted March 27, 2007 Why not change the regex to only report and error if it contains a character you do not allow? if(!ereg("[!"£$%^&*()_+=-?/.>,<#~'@;:]}[{|\]+$",$nickname)) echo 'ERROR'; maybe? monk.e.boy Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215935 Share on other sites More sharing options...
NSW42 Posted March 27, 2007 Author Share Posted March 27, 2007 tried to then but got errors, talk about pulling your hair out :-\ Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215941 Share on other sites More sharing options...
monk.e.boy Posted March 27, 2007 Share Posted March 27, 2007 start with a simple regex, also check out http://www.regexbuddy.com/ Then test and expand the regex. Also, try stristr, it is simpler. monk.e.boy Quote Link to comment https://forums.phpfreaks.com/topic/44445-solved-erega-za-z0-0-9-help-needed/#findComment-215958 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.