11
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2008/12/24 7:12

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Quote:
The username is verified trough a regexp. You can define a regular expression for the allowed input and then adapt one of the three existing possibilities for the username checking or add a fourth. This means that everyone that registers on the site has to have this kind of student form username.


If i want to ensure that the registration proceeds only if the first four letters of the username are "ABCD", what should be the defined regular expression.

Pls help

12
ghia
Re: Suggestions for a website that I am starting to work on:
  • 2008/12/24 11:47

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try with
$restriction '/.{1,3}|[^A-Z]{4}.*/';

It's intended to allow only 4 upper case letters.

13
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/2 6:36

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Thanks a lot ghia

What i really need is to ensure that letters are upper case alphabets or numbers. The first letter in all cases should be A, the second letter should be B, third Letter should be C and the fourth letter should be C again.

Hence all username need to start with "ABCC" and shall have upper case alphabets or no. following the "ABCC"

14
ghia
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/2 10:46

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try
$restriction '/.{1,18}|[^A].*|.{1}[^B].*|.{2}[^C].*|.{3}[^C].*|.{4}[^A-Z].*|.{5}[^A-Z].*|.{6}[^A-Z].*|.{7}[^A-Z].*|.{8}[^A-Z].*|.{9}[^S].*|.{10}[^1-5].*|.{11}[^0-9].*|.{12}[^0-9].*|.{13}[^0-9].*|.{14}[^0-9].*|.{15}[^0-9].*|.{16}[^0-9].*|.{17}[^0-9].*|.{18}[^0-9].*/';
for allowing only usernames with 19 characters, starting with ABCC followed by 5 uppercase, the letter S, a number from 1 to 5 and 8 digits as eg ABCCBOMNSS116120815 .

15
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/3 13:31

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Thanks Ghia but on using the above code i keep on getting
Error: invalid Username on registration.

16
ghia
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/3 14:49

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think this one will do better:
$restriction '/^.{1,18}$|^[^A].*|^.{1}[^B].*|^.{2}[^C].*|^.{3}[^C].*|^.{4}[^A-Z].*|^.{5}[^A-Z].*|^.{6}[^A-Z].*|^.{7}[^A-Z].*|^.{8}[^A-Z].*|^.{9}[^S].*|^.{10}[^1-5].*|^.{11}[^0-9].*|^.{12}[^0-9].*|^.{13}[^0-9].*|^.{14}[^0-9].*|^.{15}[^0-9].*|^.{16}[^0-9].*|^.{17}[^0-9].*|^.{18}[^0-9].*/';

17
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/3 16:01

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Thanks again i will check that out and come back with the result
also the min and max no. of characters allowed in username can be specified in xoopsadmin->system->preferences->user info settings->

18
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/4 4:50

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Quote:
I think this one will do better:

$restriction = '/^.{1,18}$|^[^A].*|^.{1}[^B].*|^.{2}[^C].*|^.{3}[^C].*|^.{4}[^A-Z].*|^.{5}[^A-Z].*|^.{6}[^A-Z].*|^.{7}[^A-Z].*|^.{8}[^A-Z].*|^.{9}[^S].*|^.{10}[^1-5].*|^.{11}[^0-9].*|^.{12}[^0-9].*|^.{13}[^0-9].*|^.{14}[^0-9].*|^.{15}[^0-9].*|^.{16}[^0-9].*|^.{17}[^0-9].*|^.{18}[^0-9].*/';

thanks a lot, that worked perfectly as i needed it to.

19
nmshah
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/4 9:39

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


also i was just thinking will there be a way to be able to make students member of groups based on S1 or S2 or S3 or S4 or S5. That means if a person in his username has per the above format specifies
S1 as the 10th and 11th character then he is automatically subscribing to become a member of registered user group and Step 1 group
S2 as the 10th and 11th character then he is automatically subscribing to become a member of Registered member group, Step 1 group and step 2 group
similarly S3 as the 10th and 11th character then he is automatically subscribing to become a member of Registered member group, Step 1 group, step 2 group and step 3 group
and so on till S5.

The groups have already been created in the xoops-admin->system->groups

20
ghia
Re: Suggestions for a website that I am starting to work on:
  • 2009/1/4 11:27

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I don't think this scheme of grades encoded in the user name is a good idea. Here are some toughts:
Does this mean that when they have a higher grade, they will have to have a new login name?
Or they get membership of the additional user groups and their user name becomes unrelated to their grade?
If they can autocomplete their registration, without admin approval, then they can choose their level by incrementing the grade part of their user name and accessing files from higher grades.

Login

Who's Online

158 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 158


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits