Jump to content

Recommended Posts

[!--quoteo(post=386709:date=Jun 21 2006, 09:45 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 21 2006, 09:45 PM) [snapback]386709[/snapback][/div][div class=\'quotemain\'][!--quotec--]
tried the sample code on php.net yet?

[a href=\"http://us2.php.net/manual/en/function.ftp-login.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.ftp-login.php[/a]
[/quote]

Thanks, im gonna try it now.
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-48450
Share on other sites

To simply redirect the browser to a ftp site that requires a login and password, you just have to know the language. Once you've got that, you can create a hyperlink, do a header redirect, or any number of things. Here's the language:

[a href=\"ftp://user:password@ftp.example.com\" target=\"_blank\"]ftp://user:password@ftp.example.com[/a]

I believe most browser supports this. Challenge, of course, is you're sending the username and password in plain text across the internet. But, come to think of it, standard FTP does the same thing.
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-48667
Share on other sites

Here is a part of my code:

<?php
if(isset($_POST['submit'])) {
header("Location:ftp://".$_GET['log'].":".$_GET['pass']."@server.com");
exit;
} else {
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="titleblue">
Username&nbsp;
</td>
<td>
<input name="log" type="text" style="color:013B84;font-weight:bold;background-color:transparent;border-color:013B84;border-width:1;border-style:solid">
</td>
</tr>
<tr>
<td class="titleblue">
Password&nbsp;
</td>
<td>
<input name="pass" type="password" style="cime-mode:active;color:013B84;font-weight:bold;background-color:transparent;border-color:013B84;border-width:1;border-style:solid">
</td>
</tr>
<tr>
<td width="10">&nbsp;
</td>
<td align="center">
<input type="submit" name="submit" value="Login" style="cursor:hand;font-weight:bold;color:000099;background-color:white;border-color:013B84;border-width:1;border-style:solid">
</td>
<td width="30">&nbsp;
</td>
</tr>
</table>
<?php
}
?>

I get this warning:
Warning: Cannot modify header information - headers already sent by (output started at C:\site\NEW\client_access.php:5) in C:\site\NEW\client_access.php on line 85

Any ideas? What am I doing wrong?
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-48677
Share on other sites

you either need to buffer output, or not output any information before the header. This is in the FAQ if you have more questions.

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95562\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=95562[/a]

For testing purposes you could include a javascript code to get you going. It should simulate a header redirect until you get your PHP header problem addressed. You will eventually want to use the PHP method, though, because not all visitors will have javascript turned on.

[code]<script language="javascript">window.location = "http://www.example.com"; </script>[/code]
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-48680
Share on other sites

Hey guys,

I have one more problem. Here is my code to ftp.php. Smth strange is happening.
When I submit my form, IE says that my ftp.php not found (404), whereas Firefox connects to ftp, but gives me "426 Connection Closed" error. Anyone knows how to fix this? Thanks.

[code]
<?php
                    
$ftp_server = "mysite.com";
$ftp_user = $_REQUEST['log'];
$ftp_pass = $_REQUEST['pass'];

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
   header("Location: ftp://$ftp_user:$ftp_pass@$ftp_server");
} else {
   include 'error_ftp.htm';
}

// close the connection
ftp_close($conn_id);
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-50988
Share on other sites

If you have unix, try curling the page

curl -I -dlog=loginname -dpass=password [a href=\"http://www.example.com/ftp.php\" target=\"_blank\"]http://www.example.com/ftp.php[/a]

the uppercase "I" will return the header only, so you can see where it's trying to send you. Copy the address and plug it in your browser.
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-50997
Share on other sites

[!--quoteo(post=389434:date=Jun 29 2006, 03:36 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 29 2006, 03:36 PM) [snapback]389434[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you have unix, try curling the page

curl -I -dlog=loginname -dpass=password [a href=\"http://www.example.com/ftp.php\" target=\"_blank\"]http://www.example.com/ftp.php[/a]

the uppercase "I" will return the header only, so you can see where it's trying to send you. Copy the address and plug it in your browser.
[/quote]

No, I don't have unix :(
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-51016
Share on other sites

go to [a href=\"http://web-sniffer.net/\" target=\"_blank\"]http://web-sniffer.net/[/a]

put in your url like this:

[a href=\"http://www.example.com/ftp.php?log=username&pass=password\" target=\"_blank\"]http://www.example.com/ftp.php?log=username&pass=password[/a]

select the "POST" radio header

submit.
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-51020
Share on other sites

[!--quoteo(post=389457:date=Jun 29 2006, 04:11 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 29 2006, 04:11 PM) [snapback]389457[/snapback][/div][div class=\'quotemain\'][!--quotec--]
go to [a href=\"http://web-sniffer.net/\" target=\"_blank\"]http://web-sniffer.net/[/a]

put in your url like this:

[a href=\"http://www.example.com/ftp.php?log=username&pass=password\" target=\"_blank\"]http://www.example.com/ftp.php?log=username&pass=password[/a]

select the "POST" radio header

submit.
[/quote]

Nevermind, i figured it out. It was because of my stupid server. Anyways, I appreciate ur help.

One more thing [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

die("Couldn't connect to $ftp_server");

Is there a way to insert html page in die() instead of just saying "Couldn't connect to $ftp_server"
Link to comment
https://forums.phpfreaks.com/topic/12606-ftp-login/#findComment-51028
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.