/    Sign up×
Community /Pin to ProfileBookmark

Question about a password script.

Hello everyone,

I’m just new here and i hope i can find my answer here.
I found this script , also this forum at [url]http://www.htmlgoodies.com/beyond/javascript/stips/article.php/3472121[/url].
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. ?

to post a comment
JavaScript

16 Comments(s)

Copy linkTweet thisAlerts:
@the_treeJun 08.2006 — 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.
Copy linkTweet thisAlerts:
@BurndailerauthorJun 08.2006 — But is there a option to do that what i asked in my question, because now i'm stuck ?
Copy linkTweet thisAlerts:
@phpnoviceJun 08.2006 — Change this line in that script:

this.location.href = location;

to this:

parent.location.href = location;
Copy linkTweet thisAlerts:
@BurndailerauthorJun 08.2006 — Thank you su mutch, it works ?
Copy linkTweet thisAlerts:
@phpnoviceJun 08.2006 — You're welcome.

Cheers.
Copy linkTweet thisAlerts:
@BurndailerauthorJun 08.2006 — Maybe you can help me also with something , i don't know.

In that script i have this part.:


[CODE]if (AccId == "" || iName == "")
{
alert('nERRORnU 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........');
}
}[/CODE]


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.
Copy linkTweet thisAlerts:
@balloonbuffoonJun 08.2006 — 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?

--Steve
Copy linkTweet thisAlerts:
@phpnoviceJun 08.2006 — Does anyone one know if AJAX (without synchronizing it with server side scripts) can determine if a page exists or not?[/QUOTE]
Yes, it is called a "HEAD"-type of HTTP Request. Then you just check the returned status code -- 200 means it exists (normally 404 if it does not).
Copy linkTweet thisAlerts:
@BurndailerauthorJun 08.2006 — and how do you do that??
Copy linkTweet thisAlerts:
@BurndailerauthorJun 08.2006 — is it also possible with that little script i paste above???
Copy linkTweet thisAlerts:
@phpnoviceJun 08.2006 — 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.)
[code=php]var filepath = "../folder/file.ext";
var str, result = '<table>n';
result += '<tr><td class="r">Checked filepath:&nbsp;</td><td>' + filepath + '</td></tr>n';
makeXMLHttpRequest(filepath, null, "HEAD");
result += '<tr><td class="r">returned status:&nbsp;</td><td>' + xmlhttp.status + '</td></tr>n';
result += '<tr><td class="r">status text of:&nbsp;</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:&nbsp;</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:&nbsp;</td><td>' + str + '</td></tr>n';
}
str = xmlhttp.getResponseHeader("Last-Modified");
if(str.length > 0) {
result += '<tr><td class="r">last modified on:&nbsp;</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);[/code]
Copy linkTweet thisAlerts:
@BurndailerauthorJun 09.2006 — 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??
Copy linkTweet thisAlerts:
@Mayank_AgrawalJun 09.2006 — Hi

I've clubbed both the posted scripts, please check if this works. Experts, please point out errors if any.




if (AccId == "" || iName == "")

{

alert('nERRORnU 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........');

}

}
Copy linkTweet thisAlerts:
@BurndailerauthorJun 09.2006 — [CODE]makeXMLHttpRequest(location, null, "HEAD");
if(xmlhttp.status == 404)
{
window.status=('Please Enter a valid combination of user ID and Password')
}[/CODE]


If i put this into my html page i get in my explorer a error sign.

When i click on that sign, he says the next.:

code.: 0

Error.: Object is expected

url.: http://xxxxxxx

(xxxx is my site name)

without that code there is no problem ?
Copy linkTweet thisAlerts:
@phpnoviceJun 09.2006 — [CODE][COLOR=Red]makeXMLHttpRequest[/COLOR](location, null, "HEAD");
if(xmlhttp.status == 404)
{
window.status=('Please Enter a valid combination of user ID and Password')
}[/CODE]


If i put this into my html page i get in my explorer a error sign.[/QUOTE]

Yes, that is correct. As I stated, the function I'm using (in [COLOR=Red]red[/COLOR] above) for my Ajax calls isn't free code that I just give away.

I created my code from scratch after reviewing this web page:

http://jibbering.com/2002/4/httprequest.html

and after reviewing the MSDN documentation on this same subject:

[URL=http://msdn.microsoft.com/library/en-us/xmlsdk/html/63409298-0516-437d-b5af-68368157eae3.asp]XMLHttpRequest[/URL]

Lastly, here is another thread talking about Ajax:

http://www.webdeveloper.com/forum/showthread.php?p=582465
×

Success!

Help @Burndailer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...