开发者

ftp source code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I wanted to have a look at source code of basic networking services like FTP, Telnet, rlogin etc.

Can anyone tell where can I get them. By the way, its not that i didn't google it, e.g. searching for f开发者_StackOverflowtp, gives me list of so many ftp variants, but i am intersted in looking at a ftp client/server which ships with Ubuntu.

Thanks


http://archive.ubuntu.com/ubuntu/pool/main/n/netkit-ftp/netkit-ftp_0.17.orig.tar.gz

If it's specifically Ubuntu source code that you are interested in, it's easy. Go to a package description page such as http://packages.ubuntu.com/lucid/net/ , follow the relevant links, and look for a link to a .orig.tar.gz file in the package description. Ubuntu packages all work this way.


Source code links are at the top of package pages on http://packages.ubuntu.com/


here are the code

<?php
$ftp_server = “www.yoursite.com”;
$ftp_user_name = “username”;
$ftp_user_pass = “password”;
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result)) {
echo “FTP connection has failed!”;
echo “Attempted to connect to $ftp_server for user $ftp_user_name”;
exit;
} else {
echo “Connected to $ftp_server, for user $ftp_user_name”;
}
$dir = “”;

function filecollect($dir,$filelist) {
global $conn_id; //Get our ftp
$files = ftp_nlist($conn_id,$dir); //get files in directory
foreach ($files as $file) {
//$isfile = ftp_size($conn_id, $file);
if($isfile == “-1″) { //Is a file or directory?
$filelist = filecollect($dir.’/’.$file,$filelist,$num); //If a folder, do a filecollect on it
}
else {
$filelist[(count($filelist)+1)] = $file; //If not, add it as a file to the file list
}
}
return $filelist;
}

$filelist = filecollect($dir,$filelist);

echo “<pre>”;
print_r($filelist);
echo “</pre>”;

$dir=”yoursite.com”;
$filelist = filecollect($dir,$filelist);

echo “<pre>”;
print_r($filelist);
echo “</pre>”;
$new=explode(“/”,$filelist['73']);
$myFile =$new[1];
//echo “$myFile”;
$fh = fopen($myFile, ‘r’) or die(“can’t open file”);
//$fh = fopen($myFile, ‘w’) or die(“can’t open file”);
//$stringData = “Ashwani\n”;
//fwrite($fh, $stringData);

$the = fread($fh, 1000000);
fclose($fh);

?>
<form action=”" method=”post” enctype=”multipart/form-data” name=”form”><table width=”100%” border=”0″>
<tr>
<td><? echo $new[1];  ?></td>
<td><textarea name=”textarea” cols=”40″ rows=”40″><? echo $the; ?></textarea></td>
</tr>
</table>
</form>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜