Forum Moderators: coopster

Message Too Old, No Replies

secure directory login using php in IE6

         

hughes

2:52 pm on Dec 7, 2004 (gmt 0)

10+ Year Member



Hi, I'm pretty new to php. Does anyone know how to login to a secured directory using php? I can get it to work when the site visitor is using mozilla, but IE will not allow a login due to the url spoofing fix.

I want to do it this way so I can disable autocomplete at the login page.

code I have is as follows:

HTML FORM

-----------------------------------------------

<body>

<form name="form1" method="post" action="login.php">
<p>
<input type="text" name="username" autocomplete="off">
Username</p>
<p>
<input type="password" name="password" autocomplete="off">
Password</p>
<p>
<input type="submit" name="Submit" value="Submit" autocomplete="off">
</p>
</form>

-------------------------------------------------

SERVER SIDE SCRIPT

LOGIN.PHP

----------------------------------------------------

<?php
$user = $_POST['username'];
$pass = $_POST['password'];

$url = "http://" . $user . ":" . $pass . "@www.domain.com/securedirectory/index.php"; // target of the redirect
$delay = "3"; // 3 second delay

echo "login in 3 seconds";

echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';

?>

Any help is much appreciated.

Hughes

ergophobe

10:52 pm on Dec 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hughes,

Welcome to WebmasterWorld!

I have to say that I pretty much don't use http authentication anymore, so I can't be much help.

That said, isn't it fair to say that IE stopped allowing this because it's a fairly serious security issue and that the technique shouldn't be used? It seems like you would want to make your users log in if you are using that type of authentication, rather than just passing the login and pass in a url.

Tom

hughes

2:02 pm on Dec 9, 2004 (gmt 0)

10+ Year Member



The problem is I'm trying to access a secure directory supplied by my hosting company. But I do not want users being able to click the remember my password option at login. The computers used to access the site are also used by external clients, some of questionable background, and I don't want them accessing a confidential area just by clicking "ok".

>>I have to say that I pretty much don't use http authentication anymore, so I can't be much help.

Could you suggest any other kind of login authentication that does not allow remembered passwords? I'm pretty new to this so any ideas are welcome.

ergophobe

6:39 pm on Dec 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm not sure. The problem is that remembering login name and password is done in two ways

- setting a cookie, which you can stop by not setting a cookie

- the "autofill" feature of browsers, which is something that is entirely client side. I would guess you might be able to prevent it with javascript or something, but it may have to be done client side. I'm not sure how you prevent browsers from automatically filling in form data if the user has things set up that way.

Is your goal primarily to prevent automatic login or primarily to prevent folks from seeing the login info?

Also, doesn't it seem sort of risky to let people into that directory? Typically, I would create a login system using PHP and create a cascading set of privileges - some people can view, some can add, some can make changes, some can delete.

Tom

hughes

9:16 am on Dec 13, 2004 (gmt 0)

10+ Year Member



Thanks for replying, I am trying to stop automatic login of the directory.

Is there a way I could check the login variables on each page using a an expiring cookie and if not present or expired, deny access? Would I need to encypt the information in the cookie?

Hughes

Adrian2k4

9:51 am on Dec 13, 2004 (gmt 0)

10+ Year Member



I had this idea on how to prevent IE form "autofilling" form fields: (i didn't test this)

I think IE saves the name of the form field to create the "autofill"-menues. So if you want to prevent the "autofilling" you have to make sure that always different names are in the <input name="...."> option.
the easiest way to do this is to us the UN*X-Timestamp or some other kind of unique token as the field name. As long as the names are different every time a user visits i think it won't "autofill".