Current location: Hot Scripts Forums » Programming Languages » PHP » Problem with PHP/.htaccess script, when using Internet Explorer


Problem with PHP/.htaccess script, when using Internet Explorer

Closed Thread
  #1 (permalink)  
Old 12-27-03, 08:37 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Problem with PHP/.htaccess script, when using Internet Explorer

Hi guys,

I am having a problem with this script, only when using Internet Explorer. The idea is for users of a .htaccess protected folder to be able to login using the form, without the Apache pop-up screen showing up and asking them to enter their username and password. Again, it works fine using Netscape, and other browsers, just not using IE (damn Micro$oft )

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>

Here is the Login.php file:

PHP Code:

 <?php
 $name 
$_POST['name'];
 
$password $_POST['password'];
 
$link "www.yoursite.com/restrictedfolder/";
 
 
$URL="http://$name:$password@$link";
 
header ("Location: $URL");
 
?>
 
 <html>
 <title>Login Redirect Page</title>
 <head></head>
 <body>
 
 </body>
 </html>
__________________
  #2 (permalink)  
Old 12-29-03, 09:53 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Does anyone have any clue why this script is not compatible with Internet Explorer? Any help would be appreciated.
__________________
  #3 (permalink)  
Old 12-29-03, 09:57 AM
Infinite_Hackers's Avatar
Infinite_Hackers Infinite_Hackers is offline
Coding Addict
 
Join Date: Dec 2003
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
in quotes
<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>
  #4 (permalink)  
Old 12-29-03, 10:37 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
I already tried that. It doesn't fix the problem.



Quote:
Originally Posted by Infinite_Hackers
in quotes
<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>
__________________
  #5 (permalink)  
Old 01-22-04, 07:15 PM
codefighter codefighter is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Wink Javascript workaround

Quote:
Originally Posted by digioz
I already tried that. It doesn't fix the problem.
Hi Digioz

I've got just the same problem.
Here my workaround:
The html-page with the form invokes a php-page that echos a html-page with following <body>-tag <body onload='href=\"http://$username:$password@www.domain.com/restricted_path/file.html\"'>
The body of the page has no content.

So the trick is loading a blank page which redirects to the originally targeted page in the .htaccess-restricted directory. Not very elegant but it works with M$hit IE too.

Hope you got it.

Best regards

codefighter
  #6 (permalink)  
Old 01-23-04, 06:46 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Thank you so much my friend.
I guess I wasn't thinking about browser redirect at all. I had some trouble getting your version to work on my server, so here is what I did instead:

Code:
<?php
 
$username = $_POST['username'];
 
$password = $_POST['password'];
 
 
 
echo "<html>";
 
echo "<title>Welcome to the Restricted Area</title><head>";
 
echo "<META HTTP-EQUIV=REFRESH CONTENT=\"0; URL=http://$username:$password@www.mydomain.com/restricted/index.html\">";
 
echo "</head><body bgcolor=\"#C0C0C0\">";
 
echo "<center><h2>Please Wait .... Login Into the Restricted Area ... </h2>";
 
echo "</body></html>"; 
 
?>
 
There is a 1 second delay until the user is redirected into the restricted area, but at least it works with browser redirect.

Again, thank you so much for the help.






Quote:
Originally Posted by codefighter
Hi Digioz

I've got just the same problem.
Here my workaround:
The html-page with the form invokes a php-page that echos a html-page with following <body>-tag <body onload='href=\"http://$username:$password@www.domain.com/restricted_path/file.html\"'>
The body of the page has no content.

So the trick is loading a blank page which redirects to the originally targeted page in the .htaccess-restricted directory. Not very elegant but it works with M$hit IE too.

Hope you got it.

Best regards

codefighter
__________________

Last edited by digioz; 01-23-04 at 06:57 AM.
  #7 (permalink)  
Old 05-31-06, 03:34 PM
Amel Amel is offline
New Member
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

I'm looking for this since so long.. i'm really happy to find a solution but I'm not really familiar with coding and I didn't understand where I have to put the latest code..

Any help would be appreciated! thank's in advance.
  #8 (permalink)  
Old 07-26-07, 11:17 PM
analoguedependent analoguedependent is offline
New Member
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
wow! ive been looking for this ie workaround for the "invalid syntax error" forever! thanks for that!

one question tho, i need the page to redirect to specific $username.shtml. is that even possible with this workaround?
Closed Thread

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 script HELP Jerome PHP 7 12-22-09 06:44 AM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 12:12 AM
Affiliate script (PHP) whtiebear Job Offers & Assistance 2 12-21-03 12:12 AM
PHP Search script problem vispa PHP 1 11-22-03 12:22 PM
I need help with my first php script NeverMind PHP 4 08-01-03 01:27 PM


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