Re: restricting access to files using PHP
| From: | David T-G | Date: | Thu, 13 Feb 2003 14:22:07 +0000 |
| Subject: | Re: restricting access to files using PHP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135449@lists.php.net to get a copy of this message | ||
Shams --
..and then Shams said...
%
..
% I'm interested in your solution David, what is the format of the external
% auth script that you use.. is there some kind of return you have to give
% .htaccess ?
Yep. It's just a simple perl script; it's attached for reference.
%
% Also, is there no way I can allow a user to login using a PHP login script,
% and then pass the "username" and "password" over to .htaccess to verify ?
Dunno about that one, but since you can tell .htaccess to run your php
script to verify you should get the same results...
%
% Thanks for the help,
Sure thing!
%
% Shams
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!
#!/usr/bin/perl $user = <>; chomp($user); $pass = <>; chomp($pass); exit(2) if($user =~ /^root$/); exit(3) if($user =~ /[^a-zA-Z0-9_@.-]/); open(CHKPW,"| /home/vpopmail/bin/vchkpw /bin/true 3<&0 >&2"); print CHKPW $user,"\0"; print CHKPW $pass,"\0"; print CHKPW time(),"\0"; if(not close(CHKPW)) { exit(4); }
#!/usr/bin/perl $user = <>; chomp($user); $pass = <>; chomp($pass); exit(2) if($user =~ /^root$/); exit(3) if($user =~ /[^a-zA-Z0-9_@.-]/); open(CHKPW,"| /home/vpopmail/bin/vchkpw /bin/true 3<&0 >&2"); print CHKPW $user,"\0"; print CHKPW $pass,"\0"; print CHKPW time(),"\0"; if(not close(CHKPW)) { exit(4); }