Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: FTP script

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question FTP script

    I need a script that will prompt a user for their username and password, and then take that username and password and create a URL. Then take this URL, and open it in a new window.

    What I need is to open a FTP window which is different based on the username and password. I have done plenty of password protected pages, but I do not know how to take those variables and massage them into a URL, and then open tat new URL in a new window.

    Any help would be great!

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    var name = prompt('Username?','');
    var pass = prompt('Password?','');
    window.open('ftp://' + name + ':' + pass + '@somedomain.com','','windowfeatures');


    Of course by doing it that way, the password will be visible in the history, but that is the only solution in Javascript.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'll give it a try

    Thanks alot!!!

    Could the username and paswword be hidden using some kind of rudimentary encryption? Alternatively, would some sort of script that purges the cache do the trick?

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Am I on the right track with this?

    I was thinking of putting the user/password in a form, with a submit button.

    I have a standard script for this...would it work?


    <script language="javascript">
    <!--//
    function pasuser(form) {
    if (form.id.value=="JavaScript") {
    if (form.pass.value=="Kit") {
    location="page2.html"
    } else {
    alert("Invalid Password")
    }
    } else { alert("Invalid UserID")
    }
    }
    //-->
    </script>

    <center>
    <table bgcolor="white" cellpadding="12" border="1">
    <tr><td colspan="2"><center><h1><i><b>Login
    Area</b></i></h1></center></td></tr>
    <tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input
    name="id" type="text"></td></tr>
    <tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
    type="password"></td></tr>
    <tr><td><center><input type="button" value="Login"
    onClick="pasuser(this.form)"></center></td><td><center><br><input
    type="Reset"></form></td></tr></table></center>

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here is an expansion on jkd`s

    <html>
    <head>
    <title>Username/Password Script</title>

    <script language="JavaScript">
    <!--
    function password(login)
    {
    winAttributes='toolbar=no,location=no,scrollbars=no,resizable=no,width=800,height=600,left=1,top=1';
    if ((document.login.user.value != "") && (document.login.pass.value != ""))
    {
    window.open("ftp://"+document.login.user.value +":"+ document.login.pass.value + "@127.0.0.1",'',winAttributes)
    }
    else
    {
    alert('Please enter your Username and Password!, If you do not have one but would like access please email me mattienewt@hotmail.com matt server coordinator')
    }
    }
    //-->
    </script>

    </head>

    <body bgcolor="#000000" text="#cccccc">

    <font face="arial,helvetica" size="2">

    <div align="center">
    <table cellpadding="2" border="2" bgcolor="#c0c0c0">
    <tr>
    <td><font face="arial,helvetica" size="2" color="#000000"><b>Username:</b></font></td>
    <td><form name="login"><input name="user" type="text" size="10"></td>
    </tr>
    <tr>
    <td><font face="arial,helvetica" size="2" color="#000000"><b>Password:</b></font></td>
    <td><input name="pass" type="password" size="10"></td>
    </tr>
    <tr>
    <td><center><input type="button" value="Login" onClick="password()">
    </center></td>
    <td><center><br><input
    type="Reset"></form></td>
    </tr>
    </table>

    </div>

    </body>
    </html>


    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the attached file has the exact code and works.

    scroots
    Attached Files Attached Files
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Almost perfect...

    What has been set up is almost perfect...

    What I now need is to open the site in a frame (the same frame that the login script is in), instead of "popping a new window.

    Can this be done?
    Last edited by jmacmillan; 06-18-2002 at 10:49 PM.

  • #8
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Replace

    window.open('bla','','bla2')

    with:

    top.FRAMENAME.location.href = 'bla'

  • #9
    New to the CF scene
    Join Date
    Jun 2002
    Location
    London
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i had a question regarding File Sharing
    ICQ 99B used this feature thru the users homepage and i would like to do something similar for my site.

    Is this at all possible that users who visit my site can access certain files from my PC?
    if so how would i code it... i tried numerous things but none work


    hope you can help


  •  

    Posting Permissions

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