The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Warn users if username is too long!
Can someone create a hack that would warn users that their username is too long, instead of just registering them with the first (insert allowed number of characters here) characters, and cutting off the rest of the name.
This is a design flaw, in my opionion. |
#2
|
||||
|
||||
In register.php find:
if (strlen($username)<$minuserlength) { before that add: if (strlen($username)>XX) { eval("standarderror(\"".gettemplate("error_toolong username")."\");");exit; } (Replace XX with max. char.number) Login Admin CP/Create a New Template named error_toolongusername Specify the text as you like (eg. "You user name is too long! Please go back and shorten it.") Regards, |
#3
|
||||
|
||||
Err, it already works like that.
Register.php: Code:
if (strlen($username)<$minuserlength) { eval("standarderror(\"".gettemplate("error_usernametooshort")."\");"); exit; } elseif (strlen($username)>$maxuserlength) { eval("standarderror(\"".gettemplate("error_usernametoolong")."\");"); exit; } |
#4
|
|||
|
|||
I registered at one board with the username of Joshua Clinard, and when I got my confirmation e-mail, my username was Joshua Clin. Obviosly the max length was 10 characters, as the last 3 characters got cut off. I have had several users on my forums with names that appeared to be cut off as well, so if it is supposed to warn users that their username is too long, then that feature does not work.
I guess I'll have to submit a bug report, which I was going to do anyways, because this is a design flaw in my opionion. |
#5
|
||||
|
||||
Perhaps the forum you registered at hacked their board. And unless users on your board tried to register with a 50-chars username, this should not and will not happen.
And if you look at Logician's post and mine, you will see that both code snippets pretty much do the same thing. |
#6
|
||||
|
||||
Quote:
|
#7
|
|||
|
|||
you could use a javascript, like this in the head:
Code:
<script language="JavaScript"> function unlength (form) { if (form.blah.length > 15) { alert("Your username is too long!"); form.blah.focus(); } } </script> Code:
<input type="text" name="blah" onBlur="unlength(this.form)"> of course, i'm no expert @ javascript; this COULD have an error |
#8
|
|||
|
|||
Well, I was wrong. I just tested this on a few forums and it does not let you type in more than the allowed number of characters. I wonder if this might be a browser incompatibility issue!
|
#9
|
||||
|
||||
No it's not, even if the user can type more than X characters, the PHP script will exit with an error message.
|
#10
|
||||
|
||||
Quote:
This hack will not let your users register with longer usernames than you allowed. So please try it and lets see if it works or not.. What Firefly said is true: This is a "server-side" check, so is not related to browser issues (unlike nicksaunders code).. Thus your users cant pass it. Regards, |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|