Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 User Names (limitation on characters)
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

samirving
Starting Member

United Kingdom
47 Posts

Posted - 20 May 2002 :  15:58:43  Show Profile
I would like to know if it is in anyway possible to limit the amount of charactesr used in a user name.

I have recently has the problem that people are registering with long user names, and using _ which makes it like this

john_smithy_the_first

when viewing forums.asp
If the author and the last poster has long names like this, then the whole table is thrown and 60% are of these two columns, and the TOPIC column is squeezed into about 100 pixels in width !

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 20 May 2002 :  16:27:39  Show Profile
Well for the _ part, in the file inc_functions.asp, around line 2249 is says this


sInvalidChars = "!#$%^&*()=+{}[]|\;:/?>,<"

if you add a _ to this list it should stop people adding that char to their username.

so it would be


sInvalidChars = "!#$%^&*()=+{}[]|\;:/?>,<_"

i've not tested this but as far as i can tell it should work


you may also want to add it to a line in register.asp around line 100

Err_Msg = Err_Msg & "<li> You may not use any of these chars in your username !#$%^&*()=+{}[]|\;:/?>,< </li>"

to

Err_Msg = Err_Msg & "<li> You may not use any of these chars in your username !#$%^&*()=+{}[]|\;:/?>,<_ </li>"


For lenght you could do something like


If Len(username) > "50" then
error with name etc
end if

you could add a check in the register.asp file


if not UserNameLenght(Request.Form("Name")) then
Err_Msg = Err_Msg & "Name to long"
end if

and add a fucntion to check the username...

but some one who knows more about this may have a better idea







Edited by - Hamlin on 20 May 2002 17:17:40
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 May 2002 :  16:56:13  Show Profile  Send ruirib a Yahoo! Message
I think the suggestions posted by Hamlin are OK. Anyhow if you care to take a look at the following post it may give some additional ideas. It doesn't answer your problem directly, but may help you finding the solution you want:
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=28042#131818

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs


Edited by - ruirib on 20 May 2002 17:01:59
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 20 May 2002 :  16:58:53  Show Profile
ok after messing around a bit i think this should work for you..

in register.asp add this

if not UserNameLength(Request.Form("Name")) then
Err_Msg = Err_Msg & "user name to long"
end if


after this..

 
if not IsValidString(Request.Form("Name")) then
Err_Msg = Err_Msg & "<li> You may not use any of these chars in your username !#$%^&*()=+{}[]|\;:/?>,< </li>"
end if


and then in the file inc_function.asp

add the following code before the line "Sub WriteFooter() %>"...

 
Function UserNameLength(userName)
if Len(userName) > "3" then
UserNameLength = False
else
UserNameLength = True
end if
end function



you can change the red number to max length name that you want.

as stated b4 someone who knows ASP may have a better solution

Up the Arse!

Edited by - Hamlin on 20 May 2002 17:17:20
Go to Top of Page

samirving
Starting Member

United Kingdom
47 Posts

Posted - 20 May 2002 :  18:04:32  Show Profile
Thanks Hamlin

I could not get your 2nd suggestion to work- tho I followed exactly your instructions !

But I got your first suggestion to work, benning the use of _ in the user name registration process !

Cheers Mate !

Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 20 May 2002 :  18:12:52  Show Profile
quote:

Thanks Hamlin

I could not get your 2nd suggestion to work- tho I followed exactly your instructions !

But I got your first suggestion to work, benning the use of _ in the user name registration process !

Cheers Mate !





the second one should work fine...at least it seems to on my computer ah well i'm pleased that the _ bit worked, did u get any soecific error when trying it?

.::Hamlin::.
Up the Arse!
Go to Top of Page

samirving
Starting Member

United Kingdom
47 Posts

Posted - 20 May 2002 :  18:18:01  Show Profile
Strangley enough NO !

I made the changes in the 2 files you said (exactly like you said).

Then I tried to register using a long user name that exceeded the numer (in red) that I allowed.

The next page just said REGISTRATION COMPLETE !
(just as normal) !

So it was like I did not do anything at all !

oh well- I am happy !

Go to Top of Page

_barbara
Junior Member

Germany
123 Posts

Posted - 20 May 2002 :  18:20:19  Show Profile
To limit the length of usernames, you can also set a maxlength for the input field in the registration form. Go to your inc_profile.asp, about line 182 and add the red part:

<INPUT name="Name" size="25" maxlength="10" value="<% =ChkString(rs("M_NAME"), "display") %>">  


This limits the input length to 10 characters. Change 10 to anything you want.

Barbara

Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 20 May 2002 :  18:35:07  Show Profile
quote:

To limit the length of usernames, you can also set a maxlength for the input field in the registration form. Go to your inc_profile.asp, about line 182 and add the red part:

<INPUT name="Name" size="25" maxlength="10" value="<% =ChkString(rs("M_NAME"), "display") %>">  


This limits the input length to 10 characters. Change 10 to anything you want.

Barbara





DOH - that was dam simple

.::Hamlin::.
Up the Arse!
Go to Top of Page

crash
Advanced Member

Netherlands
2064 Posts

Posted - 20 May 2002 :  18:35:09  Show Profile  Visit crash's Homepage
just out of curiosity: what happens when i set it to 10 right now and i have member names that are longer? meaning that new members will only be allowed 10 characters, but what happens to the already registered ones? for example when they view their profile (or is pop_profile.asp used then?)



Crash's Site | Crash is from
Go to Top of Page

_barbara
Junior Member

Germany
123 Posts

Posted - 20 May 2002 :  18:59:40  Show Profile
just tested it in my local forum...
When already registered members with longer usernames view or even edit their profiles everything is displayed normally - they can't edit their own usernames anyway. If you, as admin, edit the member's profile you get the username displayed in an input box (so you can edit it) and, here too, the longer ones are displayed correctly and aren't even cut if you update the profile. But when you edit the username you are limited to 10 characters.

Well, test yourself

Barbara

Go to Top of Page

crash
Advanced Member

Netherlands
2064 Posts

Posted - 20 May 2002 :  19:02:13  Show Profile  Visit crash's Homepage
of course i will then...



Crash's Site | Crash is from
Go to Top of Page

crash
Advanced Member

Netherlands
2064 Posts

Posted - 20 May 2002 :  19:07:32  Show Profile  Visit crash's Homepage
works fine. thanks for that!



Crash's Site | Crash is from
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 1.48 seconds. Powered By: Snitz Forums 2000 Version 3.4.07