I was trying to use ftp_connect() and ftp_login to authenticate users.
I got this error message:
Warning: ftp_connect(): php_hostconnect: connect failed in getpw.php on line 12
Warning: ftp_quit() expects parameter 1 to be resource, boolean given in getpw.php on line 20
how could this happen?
I am using php 4.3.2, phpinfo() shows that ftp was enabled.
my code looks like this:
function login_session($uname, $passwd)
{
$host = "127.0.0.1";
$hostip = gethostbyname($host);
$conn_id = ftp_connect("127.0.1"20G); -----line12 where the first warning refered
$result = true;
if (@ftp_login($conn_id, $uname, $passwd))
$result = true;
else
$result = false;
ftp_quit($conn_id); -----line20 where the second warning refered.
return $result;
}