note 29003 added to function.ftp-connect
| From: | leggato at netel dot bg | Date: | Thu, 30 Jan 2003 03:49:49 +0000 |
| Subject: | note 29003 added to function.ftp-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43111@lists.php.net to get a copy of this message | ||
There is a simple script, which gets params from a form, so you can connect to which host you want,
if you have a username and pass :)) , you will see IP address and hostname.The problem with buf
error comes from wrong code...at least I think so, because I haven't had it.
<?php
$conn_id=ftp_connect("$host");
$ftp_username=$username;
$ftp_pass=$password;
$login_result=ftp_login($conn_id,$ftp_username,$ftp_pass);
if((!$conn_id) || (!$login_result))
{
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
die(mysql_error());
}
else
{
$host_name = gethostbyaddr($ip);
$ip= gethostbyname($host_name);
echo "<center>Connected to $host_name <br> IP address is: $ip <br><b>
Wellcome user $ftp_username</b></center>";
//here you can include script, which shows directories
}
?>
Hello Bulgaria!!!!!!!!!!!
--
http://www.php.net/manual/en/function.ftp-connect.php
http://master.php.net/manage/user-notes.php?action=edit+29003
http://master.php.net/manage/user-notes.php?action=delete+29003
http://master.php.net/manage/user-notes.php?action=reject+29003