...

FTP script

jmacmillan
06-18-2002, 01:52 PM
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!:rolleyes:

jkd
06-18-2002, 05:37 PM
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.

jmacmillan
06-18-2002, 05:57 PM
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?

jmacmillan
06-18-2002, 06:30 PM
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>

scroots
06-18-2002, 06:35 PM
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:thumbsup:

scroots
06-18-2002, 09:32 PM
the attached file has the exact code and works.

scroots:thumbsup: :thumbsup:

jmacmillan
06-18-2002, 10:29 PM
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?:D

jkd
06-19-2002, 12:17 AM
Replace

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

with:

top.FRAMENAME.location.href = 'bla'

shapeshifterxs
06-29-2002, 12:05 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum