www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Question about a password script.

  1. #1
    Join Date
    Jun 2006
    Posts
    8

    Unhappy 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 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.

  2. #2
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    8
    But is there a option to do that what i asked in my question, because now i'm stuck

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637
    Change this line in that script:

    this.location.href = location;

    to this:

    parent.location.href = location;

  5. #5
    Join Date
    Jun 2006
    Posts
    8
    Thank you su mutch, it works

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    You're welcome.

    Cheers.

  7. #7
    Join Date
    Jun 2006
    Posts
    8
    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.

  8. #8
    Join Date
    Jan 2005
    Location
    Illinois
    Posts
    815
    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
    Save The Shirts!
    Don't overuse exclamation marks!!!!!!

  9. #9
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by balloonbuffoon
    Does anyone one know if AJAX (without synchronizing it with server side scripts) can determine if a page exists or not?
    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).

  10. #10
    Join Date
    Jun 2006
    Posts
    8
    and how do you do that??

  11. #11
    Join Date
    Feb 2006
    Location
    Where I live, people get shot. I need to move.
    Posts
    634
    If life gives you a hard knock once in a while, your lucky. All I keep getting is a savage beating... everyday!
    AJAX! - Javascript Sha1 & MD5 - ASCII tables - Zend DevZone - My Space
    Stop Badware - Create "TEXT FILE" in Javascript - . - wikipedia on PHP -

  12. #12
    Join Date
    Jun 2006
    Posts
    8
    is it also possible with that little script i paste above???

  13. #13
    Join Date
    Dec 2004
    Posts
    8,637
    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 
    strresult '<table>\n';
    result += '<tr><td class="r">Checked filepath:&nbsp;<\/td><td>' filepath '<\/td><\/tr>\n';
    makeXMLHttpRequest(filepathnull"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); 
    Last edited by phpnovice; 06-08-2006 at 05:54 PM.

  14. #14
    Join Date
    Jun 2006
    Posts
    8
    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??

  15. #15
    Join Date
    Jun 2006
    Posts
    1

    Try this

    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........');
    }
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles