Het wil mij niet lukken om mijn php code error vrij te krijgen. Ik ben geëindigd met de volgende error.
Parse error: parse error, unexpected '<' in E:\sites\ftpaccess\ftp.php on line 208
Volgens de telling zou ik de fout in regel 208 kunnen vinden, dus daar heb ik eerst gezocht. Regel 208 is:
Deze error krijg ik met de volgende code:
edit: Het gaat hier om een ftp client. Door middel van een ftpserver, username, en pass moet hij de inhoud van de ftp server weergeven.
Parse error: parse error, unexpected '<' in E:\sites\ftpaccess\ftp.php on line 208
Volgens de telling zou ik de fout in regel 208 kunnen vinden, dus daar heb ik eerst gezocht. Regel 208 is:
code:
1
| [img]'parent.gif'[/img] |
Deze error krijg ik met de volgende code:
code:
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
| <?php
$command = "";
if(isset($_GET["command"]))
$command = $_GET["command"];
else
$command = "listFiles";
switch($command)
{
case "listFiles":
ShowFiles();
break;
case "getFile":
GetFile();
break;
case "putFile":
PutFile();
break;
case "renameFile":
RenameFile();
break;
case "deleteFile":
DeleteFile();
break;
default:
ShowFiles();
}
function DoConn()
{
global $ftpServer;
global $ftpUser;
global $ftpPass;
$c = @ftp_connect($ftpServer);
$l = @ftp_login($c, $ftpUser, $ftpPass);
if(!$c)
die("A connection to $ftpServer couldn't be established");
else if(!$l)
die("Your login credentials were rejected");
else
return $c;
}
function ShowFiles()
{
$conn = DoConn();
$currDir = "";
// Get the name of the current directory
if(isset($_GET["currDir"]))
$currDir = $_GET["currDir"];
else
$currDir = ftp_pwd($conn);
// Retrieve a list of files and directories
// and display the appropriate icon for each
$fList = @ftp_nlist($conn, $currDir);
// We will work out the parent directory
$parentDir = strrev($currDir);
$parentDir = ereg_replace("^[a-zA-Z0-9\-]*/", "", $parentDir);
$parentDir = strrev($parentDir);
[img]'parent.gif'[/img]
<a href='ftp.php?command=listFiles&currDir=<?php echo $parentDir; ?>'>
..
</a>
<br>
for($i = 0; $i < sizeof($fList); $i++)
{
// We will remove the parent directory (if any)
// from the name of the file that gets displayed
$trimFile = ereg_replace("^$currDir", "", $fList[$i]);
// Remove any forward slash at front of name
$trimFile = ereg_replace("^/", "", $trimFile);
if(@ftp_chdir($conn, $fList[$i]))
{
@ftp_cdup($conn);
?>
[img]'folder.gif'[/img]
<a href='ftp.php?command=listFiles&currDir=<?php echo $fList[$i]; ?>'>
<?php echo $trimFile; ?>
</a>
<br>
<?php
}
else
{
?>
[img]'file.gif'[/img]
<a href='ftp.php?command=getFile&currFile=<?php echo $fList[$i]; ?>&currDir=<?php echo $currDir; ?>'>
<?php echo $trimFile; ?>
</a>
<br>
<?php
}
}
}
function GetFile()
{
$conn = DoConn();
$currDir = "";
// Get the name of the current directory
if(isset($_GET["currFile"]))
{
$currFile = $_GET["currFile"];
// We need to work out the name of the file
// by stripping away the path, etc
$localFile = strrev($currFile);
$localFile = substr($localFile, 0, strpos($localFile, "/"));
$localFile = strrev($localFile);
$localFile = "___$localFile";
if(@ftp_get($conn, $localFile, $currFile, FTP_BINARY))
{
// Success
}
else
{
// Failure
}
?> |
edit: Het gaat hier om een ftp client. Door middel van een ftpserver, username, en pass moet hij de inhoud van de ftp server weergeven.
[ Voor 13% gewijzigd door Verwijderd op 18-08-2004 07:40 ]