| | |
html/php form for .htaccess validation
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 18
Reputation:
Solved Threads: 0
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?
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?
•
•
Join Date: Feb 2008
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
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?

this may be a (-nother) stupid question but. . .
"My Realm" should be the folder name of the protected area... right?
•
•
Join Date: Feb 2008
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
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]
.
Thanks
•
•
Join Date: Feb 2008
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
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
![]() |
Other Threads in the PHP Forum
- Previous Thread: Need PHP/MYSQL database help
- Next Thread: Upload_err_no_tmp_dir
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alerts apache api array beginner binary broken cakephp checkbox class cms code convert cron curl database date directory display download dynamic echo email error file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql network object oop overwrite parse paypal pdf php problem query radio random recursion redirect regex remote script search securephp server sessions sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





