i have a form with user and password inputs. when the user clicks 'submit', i want to redirect the user to an ftp site:
[url]ftp://user:pass@mydomain.com[/url]
i tried a javascript approach:
<script language="Javascript">
function doFTP(form) {
document.location = "ftp://" + escape(form.user.value) + ":" + escape() + "@mydomain.com";
return false;
} // doFTP()
</script>
this one doesn't work
<form onSubmit="doFTP(this)">
User <input type="text" name="user"><br>
pass <input type="password" name="pass"><br>
<input type="submit" name="submit" value="log in">
</form>
but the page doesn't redirect...or rather it goes to
http://mydomain.com/script.php?user=jason&pass=pass&submit=log+in
and i've also tried this approach:
<?
if (isset($_POST['submit'])) {
$url = "ftp://" . urlencode(stripslashes($_POST['user'])) . ":" . urlencode(stripslashes($_POST['pass'])) . "@mydomain.com";
echo "<html><meta http-equiv=\"refresh\" content=\"0;url=" . $url . "\"></html>";
exit;
}
?>
<form method="post" action=<?=$_SERVER['PHP_SELF'] ?>>
try this one
User <input type="text" name="user"><br>
pass <input type="password" name="pass"><br>
<input type="submit" name="submit" value="log in">
</form>
But i get a 'page cannot be displayed' error in IE and a '421 you are not permitted to make this connection' error in mozilla.
Is this possible to do? Or should I write some kind of proxy? If the answer is 'proxy', then i could use a link to a sample 🙁