Current location: Hot Scripts Forums » Programming Languages » PHP » HELP! Php to login to HTACCESS?


HELP! Php to login to HTACCESS?

Reply
  #1 (permalink)  
Old 03-05-04, 11:41 PM
godfather godfather is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
HELP! Php to login to HTACCESS?

Well, I had a handy script where you could login and it passed the login to htaccess via the addressbar.

user : pass @ server.com. This was used to login.

I am REALLY looking for a script where someone could login, and based upon login sends them to their htaccess protected directoy without them having to login again.

ANYONE have a clue?

Feb 4th Microsoft patched the above method to no longer work. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-06-04, 12:19 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
Here is the solution that I came up with a few weeks ago. Use it at your own risk:

// File login.html ----------------------------------

Code:
<!doctype html public "-//w3c//dtd html 3.2//en">
 
 <html>
 
 <head>
 <title>Login Page</title>
 </head>
 
 <body bgcolor="#808080" text="#000000" link="#8080ff" vlink="#0000ff" alink="#ffff00">
 
 <form method="post" action="login.php">
	<b> Username </b>&nbsp;&nbsp;<input type="text" name="name"><br>
	<b> Password </b>&nbsp;&nbsp;&nbsp;<input type="password" name="password"><br>
	<br>
  <input type="submit" name="Login" value="Login">
 </form>
 </body>
 
 </html>
// File login.php ----------------------------------
PHP Code:

<?php
// These two values are passed from the form ---------------------------
$username $_POST['name'];
$password $_POST['password'];
// Change these values to fit your site --------------------------------
$domain   "[url="http://www.yourdomain.com"]www.yourdomain.com[/url]";  // Your Domain
$restrict "members";    // The restricted directory
$pagetitle"Your Page Title Here;  // Title of the Page

echo "
<html><head><title>$pagetitle</title><META HTTP-EQUIV=REFRESH CONTENT=\"0; 
URL=http://
$username:$password@$domain/$restrict\"></head>";
echo 
"<body bgcolor=\"#C1C1C9\">";
echo 
"<center><h2> Login into the Members Area ... </h2>";
echo 
"</body></html>"
?>
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-06-04, 12:54 AM
godfather godfather is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the post, but..

URL=http://$username:$password@$domain/$restrict\"></head>";

Microsoft disabled this if you update a security update dated Feb 4 2004. THey no longer allow user / password in the url. I did find a workaround by redirecting via the htaccess file itself, but its not great.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-06-04, 01:00 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
Leave it to Microsoft to take the fun out of everything.

Could you post your workaround here for us?





Quote:
Originally Posted by godfather
Thanks for the post, but..

URL=http://$username:$password@$domain/$restrict\"></head>";

Microsoft disabled this if you update a security update dated Feb 4 2004. THey no longer allow user / password in the url. I did find a workaround by redirecting via the htaccess file itself, but its not great.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-06-04, 01:03 AM
godfather godfather is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
I take no credit here.... I am just looking for a solution like the above, NOW. That is, since M$ broke it..


Link..
http://forums.devshed.com/archive/t-12716

The last post on that page by: unclehighbrow

Says..
Well, it's been a long time, but I just came across this posting again recently, and I hadn't read freebsd's suggestion to post what I got, but here it is now:

AuthUserFile /Library/WebServer/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
RewriteEngine on
RewriteCond %{REQUEST_URI} /client/?$
RewriteRule . /client/%{REMOTE_USER} [L,R]
require valid-user

Works like a charm. Hope it's of use to someone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Problem with PHP/.htaccess script, when using Internet Explorer digioz PHP 7 07-27-07 12:17 AM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 01:31 AM
How to convert php generated pages to SE friendly HTML or PHP(SE friendly) -CLASS 101 crippled PHP 1 11-16-03 07:37 AM
Search Engine URL: htaccess, dynamic php, & Frontpage ext. cebuy PHP 5 11-13-03 12:45 AM


All times are GMT -5. The time now is 10:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.