I'm just new here and i hope i can find my answer here.
I found this script , also this forum at http://www.htmlgoodies.com/beyond/ja...le.php/3472121.
That script works just fine, because the site is not so importent.
But my question is as next.:
I've in my site a menu in a inline frame.
With all the links i juse target="_parent" to stay in the main screen (window).
Now i also want that when i login with that script above, that it also stay in the main window.
But i tryed everything but evertime the new page comes in that iframe.
What must i do??
Sorry for my bad english i'm from The Netherlands.
Client-side authenitication (processing the passwords on your visitors end) is completely pointless, anyone can view your source code. And don't use HTML-Goodies, most of what is on there is utter crap.
Avoid iframes as well. If you have any server-side scripting avaliable (check) then you'll be able to do all of this securly, easily and without the trouble your having with some really simple scripts.
Maybe you can help me also with something , i don't know.
In that script i have this part.:
Code:
if (AccId == "" || iName == "")
{
alert('\nERROR\nU moet al uw gegevens invullen,\nom door te gaan.\n');
window.status=('Mis data of verkeerde data ingevuld. Controleer de gegevens, ze zijn hoofdletter gevoelig!!')
}
else
{
var location=("pw" + iName + AccId + ".html" );
parent.location.href = location ;
window.status=(' Verifying: ' + iName + '-' + AccId + ' Please wait........');
}
}
It means that what the user types as login and password, that page wil be showed, example....pwfrank1234.html
What must i do when the user types a wrong password, so he gets a error page that he has writen a wrong login or password.
I had a idea about if function but don't know how to inplant it into the script.
You would have to check to see if the page with the login and password existed, which may be possible using AJAX. Does anyone one know if AJAX (without synchronizing it with server side scripts) can determine if a page exists or not?
The function I created to handle this is not free code. But, the following demonstrates some of the properties you can utilize once you get your own understanding of how to do Ajax calls. (PHP bounding tags around this JavaScript are for coloring only.)
PHP Code:
var filepath = "../folder/file.ext";
var str, result = '<table>\n';
result += '<tr><td class="r">Checked filepath: <\/td><td>' + filepath + '<\/td><\/tr>\n';
makeXMLHttpRequest(filepath, null, "HEAD");
result += '<tr><td class="r">returned status: <\/td><td>' + xmlhttp.status + '<\/td><\/tr>\n';
result += '<tr><td class="r">status text of: <\/td><td>' + xmlhttp.statusText + '<\/td><\/tr>\n';
if(xmlhttp.status == 200) {
result += '<tr><td class="r">meaning the file exists,<\/td><td>and<\/td><\/tr>\n';
str = xmlhttp.getResponseHeader("Content-Length");
if(str.length > 0) {
result += '<tr><td class="r">the data length is: <\/td><td>' + str + ' bytes<\/td><\/tr>\n';
}
str = xmlhttp.getResponseHeader("Content-Type");
if(str.length > 0) {
result += '<tr><td class="r">the mime type is: <\/td><td>' + str + '<\/td><\/tr>\n';
}
str = xmlhttp.getResponseHeader("Last-Modified");
if(str.length > 0) {
result += '<tr><td class="r">last modified on: <\/td><td>' + str + '<\/td><\/tr>\n';
}
} else {
result += '<tr><td class="r">where a status of 404<\/td>';
result += '<td>means the file does not exist.<\/td><\/tr>\n';
}
result += '<\/table>\n';
document.write(result);
Sorry but this is new for me, i dont know how to start and were to place it
I'm not so good in html or something elswith programming.
Is there no easer way to give a return answer if a the page is not found??
Hi
I've clubbed both the posted scripts, please check if this works. Experts, please point out errors if any.
if (AccId == "" || iName == "")
{
alert('\nERROR\nU moet al uw gegevens invullen,\nom door te gaan.\n');
window.status=('Mis data of verkeerde data ingevuld. Controleer de gegevens, ze zijn hoofdletter gevoelig!!')
}
else
{
var location=("pw" + iName + AccId + ".html" );
makeXMLHttpRequest(location, null, "HEAD");
if(xmlhttp.status == 404)
{
window.status=('Please Enter a valid combination of user ID and Password')
}
else
{
parent.location.href = location ;
window.status=(' Verifying: ' + iName + '-' + AccId + ' Please wait........');
}
}
Bookmarks