Connecting Tech Pros Worldwide Help | Site Map

PHP-.htaccess-CGI

  #1  
Old July 17th, 2005, 01:54 PM
psk79
Guest
 
Posts: n/a
Hi all,

I created a set of pages with PHP for login using a database. Now, I
need to
link to a lot of CGI programs in a folder with protected-access
(.htaccess). The
username and password are the same as the ones people use to login
with. Is there a way to use the session usrname/password for the HTTP
authentication to that folder ?? If I remove the .htaccess for that
particular folder, then all those files will have access without any
kind of authentication.

I tried username:password@www.example.com . But this doesnt work with
IE 6. So I need something else.

  #2  
Old July 17th, 2005, 01:54 PM
psk79
Guest
 
Posts: n/a

re: PHP-.htaccess-CGI


Or is there any server/env /session variable that can be checked in the
beginning of these CGI programs or redirect to login page. This way I
can add a line in all those cgi programs to check whether a variable is
set or not. And remove the .htaccess file.

  #3  
Old July 17th, 2005, 01:54 PM
psk79
Guest
 
Posts: n/a

re: PHP-.htaccess-CGI


Can I set $_ENV['REMOTE_USER'] to some value ?? Or it can only b set
by apache ??

My plan is to set $_ENV['REMOTE_USER'] to username when user logs in
and in the cgi script, check if $_ENV['REMOTE_USER'] is defined.

  #4  
Old July 17th, 2005, 01:54 PM
Gordon Burditt
Guest
 
Posts: n/a

re: PHP-.htaccess-CGI


>Can I set $_ENV['REMOTE_USER'] to some value ?? Or it can only b set[color=blue]
>by apache ??[/color]

Don't expect such a change to last longer than a single page run,
if it works at all. You probably want to look at $_SESSION[] and
sessions.

Gordon L. Burditt
  #5  
Old July 17th, 2005, 01:54 PM
Alvaro G Vicario
Guest
 
Posts: n/a

re: PHP-.htaccess-CGI


*** psk79 wrote/escribió (28 Apr 2005 11:20:29 -0700):[color=blue]
> I created a set of pages with PHP for login using a database. Now, I
> need to
> link to a lot of CGI programs in a folder with protected-access
> (.htaccess). The
> username and password are the same as the ones people use to login
> with. Is there a way to use the session usrname/password for the HTTP
> authentication to that folder ?? If I remove the .htaccess for that
> particular folder, then all those files will have access without any
> kind of authentication.[/color]

I've not really understood what you're trying to accomplish. With Apache
you can password protect CGI files the very same way you protect any other
type of resource: copy your .htaccess file to your cgi-bin folder or any
parent folder.

Maybe you want to write a CGI script that makes use of HTTP authentication.
There must probably be some pre-written libraries out there; the method
itself is not hard to implement, but you need to find and read the RFC
document (you must send an specific HTTP header with auth info). You can
also connect with a browser and sniff the header sent by it. The
LiveHTTPHeaders extension for Mozilla/Firefox makes so very easy.

[color=blue]
> I tried username:password@www.example.com . But this doesnt work with
> IE 6. So I need something else.[/color]

All modern browsers allow you to store passwords, you don't need to add it
to bookmarks, if that's what you mean.


--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
php-5.2.5 compile error with xmlrpc Benjamin Grieshaber answers 0 December 4th, 2007 12:35 PM
error while doing 'make' in php-5.2.1 tsivaraman@gmail.com answers 0 February 12th, 2007 03:35 PM
Submit Buttons using php ansc1 answers 1 February 5th, 2007 07:55 AM
using php to populate a <ul Japhy answers 4 October 4th, 2005 07:05 PM
why can't i reach www.php.net? lawrence answers 3 July 17th, 2005 12:50 AM