Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2001, 08:18 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't want people to be able to sign up with symbols in their usernames, like the forwards slash, and the paranthases, and so on. The only symbol I want people to be able to use in thier username is the underscore. No periods, commas, or other symbols or punctuation marks. Is there a way to prevent this?
Reply With Quote
  #2  
Old 12-09-2001, 10:09 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

open register.php

look for

PHP Code:
  if (strlen($username)<$minuserlength) {
    eval(
"standarderror("".gettemplate("error_usernametooshort")."");");
    exit;
  } elseif (
strlen($username)>$maxuserlength) {
    eval(
"standarderror("".gettemplate("error_usernametoolong")."");");
    exit;
  } 
below it add
PHP Code:
  if(!preg_match("/^[a-zA-Z_0-9]+$/"$username)) {
    eval(
"standarderror("Invalid Characters you can only use a-z, 1-9 or an underscore in your username.");");
    exit;
  } 
Reply With Quote
  #3  
Old 12-10-2001, 12:31 AM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. I'm just curious, but has this been tested?
Reply With Quote
  #4  
Old 12-10-2001, 12:08 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah it will work, it allow characters for a-z A-Z underscore and numbers in the range 0-9.

Hence the

a-zA-Z_0-9

but i believe that

PHP Code:
if (!preg_match("/^\w+$/"$username)) {
  eval(
"standarderror("Invalid Characters you can only use a-z, 1-9 or an underscore in your username.");");
  exit;

as \w represents word in perl thought it depends on locale settings
Reply With Quote
  #5  
Old 12-16-2001, 07:48 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didn't realize that this hack was also going to prevent the use of spaces. I don't want it to do that. Is there anyway to fix that? If I just typed in a space after the _ would that do it? By the way, I don't get what you were trying to say in your last post! Can you tell me what that means?
Reply With Quote
  #6  
Old 12-18-2001, 03:50 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can someone please help? I want to get this fixed.
Reply With Quote
  #7  
Old 01-08-2002, 03:07 PM
StarBuG's Avatar
StarBuG StarBuG is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 1,033
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ever tried to use the html code for space in that definition?
"& n b s p ;" or "& # 1 6 0 ;" (without the spaces and "!)

like

PHP Code:
if(!preg_match("/^[a-zA-Z_0-9& n b s p ;]+$/"$username)) {
    eval(
"standarderror("Invalid Characters you can only use a-z, 1-9 or an underscore in your username.");");
    exit;
  } 
(also without spaces of course)

don?t know if it works but it is woth a try

Greetings

StarBuG
Reply With Quote
  #8  
Old 01-10-2002, 03:03 PM
Joshua Clinard Joshua Clinard is offline
 
Join Date: Nov 2001
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The answer is to add a space after 9 in this code
PHP Code:
[a-zA-Z_0-
This has been tested. Thanks to Hoojx for help with this.
Reply With Quote
  #9  
Old 01-10-2002, 03:25 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this works as well

PHP Code:
if (!preg_match("/^w+$/"$username)) {
  eval(
"standarderror("Invalid Characters you can only use a-z, 1-9 or an underscore in your username.");");
  exit;

Reply With Quote
  #10  
Old 06-27-2002, 10:15 AM
Sion Sion is offline
 
Join Date: Feb 2002
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I allow a dash (-) aswell? Coz when I added it it didn't seem to work!

--Sion
Reply With Quote
Reply


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 03:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06240 seconds
  • Memory Usage 2,264KB
  • Queries Executed 13 (?)
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
  • (6)bbcode_php
  • (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_postinfo_query
  • fetch_postinfo
  • 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