Jump to content

Lot's of errors

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Umm.. i have this problemo..
here's my function:

function list_dir($dir){

if(is_dir($dir)){

if($handle = opendir($dir)){

echo "<form action='' method='post'>";

echo "<table width='100%' border='0' align='center'>";

while(($file = readdir($handle)) !== false){


$filesize = filesize($file);

$lastchanged = date("F d Y - H:i:s",filemtime($file));

$filetype = filetype($file);

if($filetype == "file"){

$filetype = "File";

}elseif($filetype == "dir"){

$filetype = "Directory";

}


if(is_dir($file)){

$url = "?act=show&folder=".$file;

}elseif(!is_dir($file)){

$url = "?act=show&file=".$file;

}


if($file != "." && $file != ".." && $file != "Thumbs.db" && is_dir($file)){

echo "<tr>";

echo "<td width='25%' bgcolor='#cedee4'><input type='checkbox' name='".$file."'> <a href='".$url."'><font id='base-text' style='color:black'>".$file."</font></a></td>";

echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".filesize_r($file)." bytes</font></td>";

echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".$filetype."</font></td>";

echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".$lastchanged."</font></td>";

echo "</tr>";

}

}


closedir($handle);

}

}

}

and here's now i'll display my directories:

$rootdir = $_SERVER["APPL_PHYSICAL_PATH"];

$subdir = $_SERVER['PHP_SELF'];

$subdir = explode("/", $subdir);

$subdir = $subdir['0'];

$folder = $_GET['folder'];

$pathUrl = $rootdir."\\".$subdir;

$pathSplit = explode("\\", $pathUrl);

$pathSize = sizeof($pathSplit);

$pathReal = $pathSize-2;

$path = $pathSplit[$pathReal];

list_dir($rootdir);

:/ but i will get these errors..:

Quote

Warning: filesize() [function.filesize]: stat failed for calc.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for calc.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for calc.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for cmd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for cmd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for cmd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for downloadcounter in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for downloadcounter in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for downloadcounter in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for ext-2.0 in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for ext-2.0 in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for ext-2.0 in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for fm in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for fm in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for fm in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for fmp in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for fmp in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for fmp in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for forum in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for forum in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for forum in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for fw in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for fw in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for fw in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for gd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for gd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for gd in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for mime.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for mime.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for mime.php in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for phpadmin in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for phpadmin in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for phpadmin in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for phpbb in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for phpbb in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for phpbb in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for test in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for test in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for test in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

Warning: filesize() [function.filesize]: stat failed for tree in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 43

Warning: filemtime() [function.filemtime]: stat failed for tree in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 44

Warning: filetype() [function.filetype]: Lstat failed for tree in D:\Program Files\Abyss Web Server\htdocs\fmp\index.php on line 45

:/ maybe someone can help me and tell me what's wrong

#2
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
Its giving you an error for each file..?

#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
yup yup.. ^^
well.. it goes like this

Main folder
D:\Program Files\Abyss Web Server\htdocs

Folder and file where i'm executing my script
D:\Program Files\Abyss Web Server\htdocs\fmp\index.php

and i try to get info from
D:\Program Files\Abyss Web Server\htdocs

but it don't wanna work.. it's so wierd

#4
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
so you're trying to recall files from "../"

I dont see that anywhere in your code, did you substitute it with something that I dont get? lol

#5
Guest_Jaan_*

Guest_Jaan_*
  • Guests
i tried it.. it don't work ;)

#6
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
stat() is only available on operating systems [not Windows] that support `st_blksize.` Upon failure, stat() throws an E_WARNING - hence your warnings.

#7
Guest_Jaan_*

Guest_Jaan_*
  • Guests

John said:

stat() is only available on operating systems [not Windows] that support `st_blksize.` Upon failure, stat() throws an E_WARNING - hence your warnings.

Okay... this don't help me much..
anyone have any ideas how to fix it?

btw.. these are the lines:

43. $filesize = filesize($file);
44. $lastchanged = date("F d Y - H:i:s",filemtime($file));
45. $filetype = filetype($file); 


#8
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Have you considered looking in the PHP manual, rather than asking someone to fix it for you?

#9
Guest_Jaan_*

Guest_Jaan_*
  • Guests
problem is that.. i havent used this stat() function ;)

#10
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
You don't, but the functions filesize(), filetype(), and filename() do. ;)

#11
Guest_Jaan_*

Guest_Jaan_*
  • Guests
hmm..
so.. there's no way to fix it?

#12
bigsnake

bigsnake

    Newbie

  • Members
  • Pip
  • 1 posts
Look at this, seems to work well

<?
function list_dir($dir){ 
	if(is_dir($dir)){ 
	 	[B][COLOR="Red"]chdir($dir);[/COLOR][/B]		if($handle = opendir([B][COLOR="red"]"."[/COLOR][/B])){ 
			echo "<form action='' method='post'>"; 
			echo "<table width='100%' border='0' align='center'>"; 
			while(($file = readdir($handle)) !== false){ 

				$filesize = filesize($file); 
				$lastchanged = date("F d Y - H:i:s",filemtime($file)); 
				$filetype = filetype($file); 
				if($filetype == "file"){ 
					$filetype = "File"; 
				}elseif($filetype == "dir"){ 
					$filetype = "Directory"; 
				} 

				if(is_dir($file)){ 
					$url = "?act=show&folder=".$file; 
				}elseif(!is_dir($file)){ 
					$url = "?act=show&file=".$file; 
				} 

				if($file != "." && $file != ".." && $file != "Thumbs.db" && is_dir($file)){ 
					echo "<tr>"; 
					echo "<td width='25%' bgcolor='#cedee4'><input type='checkbox' name='".$file."'> <a href='".$url."'><font id='base-text' style='color:black'>".$file."</font></a></td>"; 
					echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".filesize($file)." bytes</font></td>"; 
					echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".$filetype."</font></td>"; 
					echo "<td width='25%' bgcolor='#cedee4'><font id='base-text' style='color:black'>".$lastchanged."</font></td>"; 
					echo "</tr>"; 
				} 
			} 

			closedir($handle); 
		} 
	} 
}  

list_dir('images');
?>