Web Analytics Made Easy -
StatCounter FTP script - CodingForum

Announcement

Collapse
No announcement yet.

FTP script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.
    jasonkarldavis.com

    Comment


    • #3
      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?

      Comment


      • #4
        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>

        Comment


        • #5
          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 [email protected] 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

          Comment


          • #6
            the attached file has the exact code and works.

            scroots
            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

            Comment


            • #7
              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; Jun 18, 2002, 06:49 PM.

              Comment


              • #8
                Replace

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

                with:

                top.FRAMENAME.location.href = 'bla'
                jasonkarldavis.com

                Comment


                • #9
                  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

                  Comment

                  Working...
                  X