The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Disallow Special Chars in Username
THis would be great to have ( to lazy to make it ) but I have some poeple come on my site and register names like
~~~Mary~~~ and that for some odd reason makes me mad... so it would like a hack that only allows letters and numbers at registration. thanks for your time - Dan :ninja: |
#2
|
||||
|
||||
In register.php find:
if (strlen($username)<$minuserlength) { before that add: ------ cut ----------- // enter not allowed chars here seperated with a space: $illegaluserchars=', . ~ ;'; $dontlethimuse=explode(" ",$illegaluserchars); while (list($key,$val)=each($dontlethimuse)) { if (strpos($username,$val)) { eval("standarderror(\"".gettemplate("error_notallo wedusername")."\");");exit; } } ------ cut ----------- Create a template named "error_notallowedusername" and specify your error message that will be posted if someone enters an invalid char. This is not tested so it may require some polishing and debugging, but needless to say, you can handle it perfectly. Also dont forget to add another if clause if you want to ban space or ' char..Enjoy.. Regards, Logician |
#3
|
||||
|
||||
ops I've just noticed that you ONLY want numbers or letters in the username. So this is easier to apply:
PHP Code:
|
#4
|
||||
|
||||
thank you this really take some of my stress of coding off
|
#6
|
|||
|
|||
sorry to bring back a REALLY OLD thread. but after endless searching, this was the only post regarding this I could find.
Will this code also work with vB 3.0.8 If not, could you please provide me with a code that would. |
#7
|
||||
|
||||
Quote:
PHP Code:
PHP Code:
|
#8
|
|||
|
|||
great! and this will provent usernames from having a space also?
|
#9
|
||||
|
||||
Quote:
|
#10
|
||||
|
||||
Maybe easier:
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|