473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HTTP-auth workaround

I'm looking for a way to force basic http autentication from within a PHP
script.

Here's the situation:

I have an exisiting system that first authenticates people via the aMemberPro
package. In the "old days", aMemberPro then moved the user to a page inside a
directory protected with .htaccess basic authentication. It used the URL
format http://name:pa******@server.directory.page.html. When the IE6 update
came out, this syntax no longer worked.

As a workaround, the "name:password@" was removed. Now, users have to login to
the aMemberPro page then login again to the protected content of the website.

I have access to the userid and password. Is there a way that I can set things
up right before the user is redirected to the server/directory/page.html
inside the protected directory so the web server's authentication will be
satisifed and the user will not be prompted again for userid/password?

I've tried plugging values for $_SERVER[remote_user], but I still get prompted
by the server for userid/password.

Thanks for any suggestions.
Jul 17 '05 #1
3 2269
Steven Stern wrote:
Here's the situation:

I have an exisiting system that first authenticates people via the aMemberPro
package. In the "old days", aMemberPro then moved the user to a page inside a
directory protected with .htaccess basic authentication. It used the URL
format http://name:pa******@server.directory.page.html. When the IE6 update
came out, this syntax no longer worked.

As a workaround, the "name:password@" was removed. Now, users have to login to
the aMemberPro page then login again to the protected content of the website.

I have access to the userid and password. Is there a way that I can set things
up right before the user is redirected to the server/directory/page.html
inside the protected directory so the web server's authentication will be
satisifed and the user will not be prompted again for userid/password?

I've tried plugging values for $_SERVER[remote_user], but I still get prompted
by the server for userid/password.

Thanks for any suggestions.


One possibility is not to actually direct over there. Use a wrapper
script to get the page content and display it based on the user/pass
already used.

For instance, write a script that does something like:

readfile('http://'.$username.':'.***********@www.example.com/dir/file.html');

So what you'd do is redirect to this page, get the user/pass, add it to
the above line, and end the script. If you want the user to click
through links in the pages there, your best bet is to have them just log
in a second time...

Hmm... a better solution is to use the Basic Auth as the login in the
first place, even if you want to use PHP to do it:

http://us2.php.net/features.http-auth

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #2
On Tue, 27 Apr 2004 18:25:45 GMT (more or less), Justin Koivisto
<sp**@koivi.com> wrote:
Hmm... a better solution is to use the Basic Auth as the login in the
first place, even if you want to use PHP to do it:

http://us2.php.net/features.http-auth


That's where I started. I may yet wind up re-writing things so I get the
id/psw, check it against aMember's database, then go on with the http-auth
login. My hope is that I can do this with the minumum modification to
existing code. It's a website I inherited and I don't have a complete
understanding (yet) of how the aMember system works.
Jul 17 '05 #3
Steven Stern wrote:
I'm looking for a way to force basic http autentication from within a PHP
script.


And here it is
http://www.php.net/manual/en/features.http-auth.php
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
8
by: ben | last post by:
I'm trying to write a web client script in python to log onto a web page and pull some information off of it. The page has quite a few behind the scenes http things going on that are making it...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
3
by: ashesdesign | last post by:
Hi All, I am very new to php and even newer to XML. Can anyone please shed some light on how to post XML requests via HTTP. I have been searching high and low and have come across many...
5
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
4
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? ...
1
by: zpinhead | last post by:
I am unable to get my downloaded extension from pecl to link up with php properly. seems like the php.so I could not use pear install http. pear claimed the extension was already installed....
3
by: webEater | last post by:
Hey, I am writing a file that reads in an external file in the web and prints it out including the response header of the http protocol. I do this to enable cross domain XMLHttpRequests. I...
1
by: rpjd | last post by:
I am completely new to this so please bear with me here. My project involves a webpage executing php scripts via an xmlhttprequest which queries a database and returns data to the webpage. This code...
1
by: rpjd | last post by:
I am having a problem getting the http.status of an xmlhttprequest. The request readystate has come back as readystate 4, but then it stops without confirming the http.status. Any help appreciated....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.