Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 05-19-2002, 02:25 AM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 05-19-2002, 11:27 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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,
Reply With Quote
  #3  
Old 05-19-2002, 11:30 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
  }
Reply With Quote
  #4  
Old 05-19-2002, 04:44 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 05-19-2002, 04:47 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 05-19-2002, 05:01 PM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 05-19-2002, 09:55 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 05-20-2002, 04:20 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #9  
Old 05-20-2002, 04:24 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No it's not, even if the user can type more than X characters, the PHP script will exit with an error message.
Reply With Quote
  #10  
Old 05-20-2002, 04:44 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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,
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:58 AM.


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.08602 seconds
  • Memory Usage 2,247KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete