Forum Moderators: phranque

Message Too Old, No Replies

.htaccess HOWTO login ranges

         

aerofool

2:35 pm on Sep 17, 2007 (gmt 0)

10+ Year Member



I work for a manufacturing company. I need to limit access to our catalog file. The plan is for customer ID numbers to be used as logins with a single universal password. I am currently using .htaccess/.htpasswd scripts to limit entry to the folder containing the catalog files. Instead of typing out each individual login into the file with the same password over and over is there any way I can just enter in one line into the .htaccess file where it will automaticly accept ANY login that falls in the number range of 000000 to 009999.

For example, Customer A login 003654, universal password for all - strawberry

Customer B login 001856, same universal password - strawberry

and so on.

If it is possible to do this, can someone offer or direct me to a howto on it?

The pages are simple html, and I know squat about php. In the near future I will be setting up a login database, but not at this time, so please don't tell me I need to do this unless it is the only way!

Thanks in advance!

phranque

10:20 pm on Sep 17, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i would write a script to generate a password file using the htpasswd utility:
htpasswd -cb password_file_name 000000 strawberry
htpasswd -b password_file_name 000001 strawberry
htpasswd -b password_file_name 000002 strawberry
...

and then reference that password file in the .htaccess using the AuthUserFile directive as well as "require valid-user".

SeanW

2:55 am on Sep 19, 2007 (gmt 0)

10+ Year Member



That's a good idea... A shell script could save some time though :)

touch .htpasswd
for i in `seq -w 0 9999`; do
htpasswd -b .htpasswd 00$i strawberry
done