PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Warning: ftp_login() expects parameter 1 to be resource, string given in...



kingweed
26.09.2010, 10:15
Hallo,

habe eine DB mit einer Tabelle in der drei Spalten sind (adresse, user, pass).
Die PHP soll überprüfen, ob eine Verbindung zum Server mit der User/Pass Kombination möglich ist.

Wenn ich die PHP bei mir ausführe, erhalte ich:

Warning: ftp_login() expects parameter 1 to be resource, string given in Order\xampp\htdocs\FTP-TEST\ftptest.php on line 65

Der Quellcode (Ausschnitt) sieht so aus:



60: $cid = ftp_connect($add);
61: if($cid)
62: $status = 1;
63: if($status == 1)
64: {
65: $login = ftp_login($add, $us, $pw);
66: if($login)
67: $login = 1;
68: }
69: ftp_close($cid);
Was ist das Problem mit Zeile 65 ?

blackberry
26.09.2010, 10:41
Schonmal dran gedacht dir die PHP Dokumentation anzusehen?
Allein schon da sollte dir klar sein, dass du ftp_login nicht den Hostnamen übergibst.
PHP: ftp_login - Manual (http://www.php.net/manual/en/function.ftp-login.php)

Ken
26.09.2010, 10:41
bool ftp_login ( resource $ftp_stream , string $username , string $password )Der erste Parameter muss der Stream sein, nicht die Adresse. Also $cid.


65: $login = ftp_login($cid, $us, $pw);