vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Warn users if username is too long! (https://vborg.vbsupport.ru/showthread.php?t=38785)

Joshua Clinard 05-19-2002 02:25 AM

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.

Logician 05-19-2002 11:27 AM

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,

Admin 05-19-2002 11:30 AM

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;
  }


Joshua Clinard 05-19-2002 04:44 PM

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.

Admin 05-19-2002 04:47 PM

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.

FWC 05-19-2002 05:01 PM

Quote:

Originally posted by FireFly
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.
Yep, this works fine on my board and another I help admin. Of course, I am very careful when applying hacks. :)

N!ck 05-19-2002 09:55 PM

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>

and then

Code:

<input type="text" name="blah" onBlur="unlength(this.form)">

of course, i'm no expert @ javascript; this COULD have an error

Joshua Clinard 05-20-2002 04:20 PM

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!

Admin 05-20-2002 04:24 PM

No it's not, even if the user can type more than X characters, the PHP script will exit with an error message.

Logician 05-20-2002 04:44 PM

Quote:

Originally posted by Joshua Clinard
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!
Joshua, maybe it's a better idea to apply the hack into YOUR board first, instead of trying to register boards which we dont know if they applied this or any others hack.

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,


All times are GMT. The time now is 09:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01375 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete