html/php form for .htaccess validation

Reply

Join Date: Feb 2008
Posts: 18
Reputation: midget is an unknown quantity at this point 
Solved Threads: 0
midget midget is offline Offline
Newbie Poster

Re: html/php form for .htaccess validation

 
0
  #31
Feb 13th, 2008
Thnaks for your help on this -

It does not seem to change anything -

I don't use md5 I use basic unix crypt function (please no jokes
so obviously I had trouble at first -
so I simply changed that line to correspond to the encryption that is being use - lol - fantastically enough I was able to log in. . .

I know you said you didn't test the script so it is just a template - so that must be the reason it has not changed anything - but at least I got it (or you got it) to authenticate through the script - so the next step is just getting the script to work -

The one question that really stands out though is how can we get it to authenticate through the script - which means it is working - and still get the same reaction?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 18
Reputation: midget is an unknown quantity at this point 
Solved Threads: 0
midget midget is offline Offline
Newbie Poster

Re: html/php form for .htaccess validation

 
0
  #32
Feb 13th, 2008
Originally Posted by midget View Post
Thnaks for your help on this -

It does not seem to change anything -

I don't use md5 I use basic unix crypt function (please no jokes
so obviously I had trouble at first -
so I simply changed that line to correspond to the encryption that is being use - lol - fantastically enough I was able to log in. . .

I know you said you didn't test the script so it is just a template - so that must be the reason it has not changed anything - but at least I got it (or you got it) to authenticate through the script - so the next step is just getting the script to work -

The one question that really stands out though is how can we get it to authenticate through the script - which means it is working - and still get the same reaction?
I've changed the error to just about everything does not change anything

this may be a (-nother) stupid question but. . .

"My Realm" should be the folder name of the protected area... right?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 18
Reputation: midget is an unknown quantity at this point 
Solved Threads: 0
midget midget is offline Offline
Newbie Poster

Re: html/php form for .htaccess validation

 
0
  #33
Feb 17th, 2008
Originally Posted by digital-ether View Post
Here's a solution to getting around the IE problem with their disabling using the browser address bar to login via HTTP Basic Authentication.

[HTML]<script>

// url of Basic Authentication page
var auth_url = 'protected/index.php';
// url user wants to access
var private_url = 'protected/files/file.zip';

function getPrivatePage() {

var user = document.getElementById('user').value;
var pw = document.getElementById('pw').value;

// create an execute xmlHTTPRequest
var xmlhttp = false;
if (window.XMLHttpRequest) {
xmlhttp = (new XMLHttpRequest());
} else if (window.ActiveXObject) {
// find latest XMLHTTP implementation on IE
var versions = [
"Msxml2.XMLHTTP.7.0",
"Msxml2.XMLHTTP.6.0",
"Msxml2.XMLHTTP.5.0",
"Msxml2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0",
"MSXML2.XMLHTTP",
"Microsoft.XMLHTTP"];
var n = versions.length;
for (var i = 0; i < n; i++) {
try {
if (xhr = (new ActiveXObject(versions[i]))) {
break;
}
} catch (e) { /* try next */ }
}
}
if (!xmlhttp) {
location.href = auth_url;
return false;
}
xmlhttp.onreadystatechange = function() { handleGetPrivatePageResponse(xmlhttp); };
xmlhttp.open('GET', auth_url, true, user, pw);
xmlhttp.send(null);
}

function handleGetPrivatePageResponse(xmlhttp) {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('Log in successful.');
location.href = private_url;
} else if (xmlhttp.status == 401) {
alert('The Username and password are incorrect. Please try again.');
} else {
alert('An unknown Error Occurred. HTTP Status: '+xmlhttp.status);
}
}
}

</script>

<fieldset>
<legend>Enter A Username and Password to Access the Private Area</legend>
<input type="text" name="user" id="user" />
<input type="text" name="pw" id="pw" />
<input type="button" onclick="getPrivatePage();" value="Enter" />
</fieldset>
<fieldset>[/HTML]
.
May be you will help me with this - I essentially want to turn this into a logout script - by logging in to another protected area - can you tell me how I could hardline a user name and password so it sends the same one every time without having to put them in the boxes - essentially I want to get rid of the input boxes too and just have a logout button

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 18
Reputation: midget is an unknown quantity at this point 
Solved Threads: 0
midget midget is offline Offline
Newbie Poster

Re: html/php form for .htaccess validation

 
0
  #34
Feb 18th, 2008
Originally Posted by midget View Post
May be you will help me with this - I essentially want to turn this into a logout script - by logging in to another protected area - can you tell me how I could hardline a user name and password so it sends the same one every time without having to put them in the boxes - essentially I want to get rid of the input boxes too and just have a logout button

Thanks
nevermind I got it - little brain fart - thanks for all your help on this - where ever you went - I really appreciate it - still haven't got the bogus header to work but I will thanks for pointing me in the right direction!!!!

Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC