vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Limited character set in usernames (Registration) (https://vborg.vbsupport.ru/showthread.php?t=73562)

arpy 12-30-2004 10:00 PM

Limited character set in usernames (Registration)
 
I had the problem that I wanted to limit the possible usernames to a special set of characters - a regular expression.

Vb has only a function to disallow special characters, but this is not what I need, I wanted to have the first character is a char, other characters are char or numeric and the only special chars are "-" and "_".

Here is my solution I want to share with you:

Open register.php

find:
Code:

if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $_POST['username']))
replace with:
Code:

if (!preg_match('/^([a-zA-Z][a-zA-Z0-9-_]*)$/', $_POST['username']))
Change the phrase "username_semicolon" to an appropriate text.

That it ;)

I don't want to give support for this hack, because most question will probably be about regex and I'm not a regex-guru ;) and I don't think that there is any need for support - but I'll watch this thread.

arpy

EDIT:
I don't believe it - I've searched for a solution this morning, couldn't find anything and produced this hack - and now, a half hour ago Reynaldovb also released a very similiar hack here: https://vborg.vbsupport.ru/showthrea...threadid=73559.
I didn't know about the thread he mentioned.

So please choose which hack meets your need best.

HaloImpulse 12-31-2004 07:09 PM

it was just released also


All times are GMT. The time now is 06:36 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.01201 seconds
  • Memory Usage 1,708KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete