PHP-.htaccess-CGI

This is a discussion on PHP-.htaccess-CGI within the PHP Language forums, part of the PHP Programming Forums category; Hi all, I created a set of pages with PHP for login using a database. Now, I need to link ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2005
psk79
 
Posts: n/a
Default PHP-.htaccess-CGI

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.

Reply With Quote
  #2 (permalink)  
Old 04-28-2005
psk79
 
Posts: n/a
Default 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.

Reply With Quote
  #3 (permalink)  
Old 04-28-2005
psk79
 
Posts: n/a
Default 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.

Reply With Quote
  #4 (permalink)  
Old 04-28-2005
Gordon Burditt
 
Posts: n/a
Default Re: PHP-.htaccess-CGI

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


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
Reply With Quote
  #5 (permalink)  
Old 04-29-2005
Alvaro G Vicario
 
Posts: n/a
Default Re: PHP-.htaccess-CGI

*** psk79 wrote/escribió (28 Apr 2005 11:20:29 -0700):
> 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'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.


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


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
--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:25 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0