Webprogramozás arr PHP info ftp kapcsolodás hiba
(#2) shidori 2011.05.20. 16:52

shidori
shidori
Kezdő

üdv!

ha localhoston van az ftp szerver akkor kikell kommentezni az ftp_pasv-ot. itt a kod esetleg ha kell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
 
$ftp_server = 'localhost'; 
$ftp_user_name = 'user'; 
$ftp_user_pass = 'pw'; 
$ftp_directory = '/tf'; 
 
$allow_clear = 0; 
$filename = 'script filename'; 
 
$txt_filename = 'consolelog.txt'; 
 
// set up basic connection 
$conn_id = @ftp_connect($ftp_server); 
 
// login with username and password 
$login_result = @ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 
 
//ftp_pasv($conn_id, true); 
 
// check connection 
if ((!$conn_id) || (!$login_result)) { 
die("<code>FTP connection has failed!</code>"); 
} 
 
if (!ftp_chdir($conn_id, $ftp_directory)) { 
die("<code>Couldn't change directory to ".$ftp_directory.".</code>"); 
} 
 
if($_GET['clear'] && $allow_clear) { 
if(!$file = fopen($txt_filename, 'w')) { 
die("<code>Couldn't open ".$txt_filename."!"); 
} 
if(!fwrite($file, ' ')) { 
die("<code>Couldn't write to ".$txt_filename."!"); 
} 
fclose($file); 
 
if (!ftp_put($conn_id, "console.log", $txt_filename, FTP_ASCII)) { 
die("<code>Couldn't upload blank file to console.log.</code>"); 
} 
 
header("location: ".$filename); 
exit(0); 
} 
 
if (!ftp_get($conn_id, $txt_filename, $ftp_directory."/console.log", FTP_ASCII)) { 
die("<code>Couldn't get console log from server.</code>"); 
} 
 
if(!$file = fopen($txt_filename, 'r')) { 
die("<code>Couldn't open ".$txt_filename."!"); 
} 
$text = fread($file, filesize($txt_filename)); 
fclose($file); 
 
// close the connection 
ftp_close($conn_id);
 
 


de ha nem localhoston van akkor probald ezt:
1
2
3
4
5
 
 
ftp_pasv($conn_id, 1); 
 
 


a true helyett irj "1"-et

remélem tudtam segiteni! sok sikert!