anarckie

Member
Jul 10, 2002
13
0
151
I have a backend script and needed to know the easiest way of checking if a username already exists before creating the account...


Something like:

if (/home/$newuser&)
{
echo &username taken, please try again&; die;
}


Not sure what the paths would be though, any ideas?
 

anarckie

Member
Jul 10, 2002
13
0
151
Well i have another question.

Does anyone know all the exempt variables for creating an account?

Like: Username cant start with a number.
& Username cant already exist
&
&
&


Those are the only i know of, anyone know any others i can protect myself again? :)
 

taivu

Well-Known Member
Nov 22, 2001
65
0
306
[quote:84be928f70][i:84be928f70]Originally posted by anarckie[/i:84be928f70]
if (/home/$newuser&)
[/quote:84be928f70]

I would suggest using /etc/passwd for the checking instead, since there are quite a few users that don't have a home directory (different daemon accounts etc.).
 

anarckie

Member
Jul 10, 2002
13
0
151
[quote:c5c64d00d6][i:c5c64d00d6]Originally posted by taivu[/i:c5c64d00d6]
I would suggest using /etc/passwd for the checking instead, since there are quite a few users that don't have a home directory (different daemon accounts etc.). [/quote:c5c64d00d6]

Thanks, i change it.

[quote:c5c64d00d6]You might have a look at the username checks in /scripts/wwwacct[/quote:c5c64d00d6]

No i dont have access to that, can anyone look in there for me?
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
In doing a Tutorial for creating FTP accounts, this is some of what I found to apply for that area:

Characters Allowed

Although you can use almost anything for creating an ID and/or PW -- and get a message saying &successful& -- some special characters cannot be used. All special characters keys on a keyboard, can be used for inclusion within an ID and/or PW except for the following:

& ampersand
( left parenthesis
) right parenthesis
| separator (found on the same key as the backslash)
; semi-colon
& left angle bracket
& right angle bracket

Note: as odd as it may sound, you can even use * (shift+8 key) which amazes me!

The bad news is, Cpanel will &always& show a successful setup, even if it will not work for an FTP account. It was only through trial & error (using every available key on a keyboard) that I was able to determine what worked and what didn't.


Although the &not allowed& characters listed above will not work anywhere within an ID / PW, I was able to setup a FTP account using a Numeric character for the first digit.

So it may be a handy (relevent?) reference for Hosting Account setup, but should be taken with a grain of salt.
 

moronhead

Well-Known Member
Aug 12, 2001
706
0
316
Are you saying that you've found square brackets, [ and ] are acceptable for a username and FTP?
 

Website Rob

Well-Known Member
Mar 23, 2002
1,501
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
Actually, no. As the above post was only an excerpt, certain parts had been left out.

Although the allowed special characters can be used in any combination for PW's, they cannot with ID's. Haven't tested all the combinations yet for that.
 

TedButz

Registered
Nov 9, 2002
3
0
151
lets see..
youc an do
if(strlen($user) & 8) {
echo(&Too long&);
die;
} else {
// Setup Account
}