묻고답하기

test#test.zip 이라는 파일이 지워지질 않네요
계속 아래의 오류 메세지가 출력이 됩니다.

Warning: unlink() failed (No such file or directory) in /home/Freehosting/heosang/www/test/dp.php on line 123


아래는 에러가 나는 123번 부근입니다.

        elseif($delete) // if the delete button was pressed
        {
                // delete the file
                unlink($path.$delete);  =====>123번 라인입니다.
        }



테스트 하실분은 아래 링크를 눌러주세요
http://hosting.bcpark.net/~heosang/test/dp.php
여기에는 중요한 파일 없으니까 마음껏 지우시고, 테스트 해보셔도 됩니다.
php소스를 다운받아 보시고 싶으신 분은 아래것을 받으세요
http://hosting.bcpark.net/~heosang/dp.zip

=============아래는 QTO File Manager의 소스입니다.===============================
<?php
/* QTOFileManagerLite 1.0
*
*Copyright (C) 2001 Quentin O'Sullivan <quentin@qto.com> All rights reserved.
*Web Site: http://www.qto.com/fm
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either version 2
*of the License, or (at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software
*Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
************************************************************************
*/

// set these configuration variables
$user = "";  // change this to the username you would like to use. leave it empty if you dont want to use authentication
$pass = "";
$MaxFileSize = "20000000"; // max file size in bytes
$HDDSpace = "100000000"; // max total size of all files in directory
$HiddenFiles = array(".htaccess"); // add any file names to this array which should remain invisible
$EditOn = 1; // make this = 0 if you dont want the to use the edit function at all
$EditExtensions = array("htm","html","txt"); // add the extensions of file types that you would like to be able to edit

/********************************************************************/

$ThisFileName = basename(__FILE__); // get the file name
$path = str_replace($ThisFileName,"",__FILE__);   // get the directory path

if($login)
{
        if(!($u == $user && $password == $pass))
        {
                $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>The login details were incorrect</font><br><br>";
                $loginfailed = 1;
        }
}


if(($user == $u || $user == "") && $edit) // if an edit link was clicked
{
        $fp = fopen($path.$edit, "r");
        $oldcontent = fread($fp, filesize($path.$edit));
        fclose($fp);
        
$filemanager = <<<content
        <center>
        <table border="0" cellspacing="0" cellpadding="20" bgcolor="#eeeeee">
        <tr>
        <td>
        <font face="Verdana, Arial, Hevetica" size="4" color="#333333"><b>FILE MANAGER</b></font><br>
        <form name="form1" method="post" action="$PHP_SELF">
          <center>
            <textarea name="newcontent" cols="35" rows="15">$oldcontent</textarea>
            <br>
          <br>
            <input type="submit" name="save" value="Save">
            <input type="submit" name="cancel" value="Cancel">
                        <input type="hidden" name="u" value="$u">
                        <input type="hidden" name="savefile" value="$edit">
          </center>
        </form>
        </td>
        </tr>
        </table>
        </center>
content;
        
}
elseif(($user == $u || $user == "") && !$loginfailed)
{
                
        if($save) // if the save button was pressed on the edit screen
        {
                $newcontent = stripslashes($newcontent);
                $fp = fopen($path.$savefile, "w");
                fwrite($fp, $newcontent);
                fclose($fp);
        }

        $HDDTotal = dirsize($path); // get the total size of all files in the directory including any sub directorys

        if ($upload) // if the upload button was pressed
        {
                if($HTTP_POST_FILES['uploadedfile']['name']) // if a file was actually uploaded
                {
                        $HTTP_POST_FILES['uploadedfile']['name'] = str_replace("%","",$HTTP_POST_FILES['uploadedfile']['name']);  // remove any % signs from the file name
                        // if the file size is within allowed limits
                        if($HTTP_POST_FILES['uploadedfile']['size'] > 0 && $HTTP_POST_FILES['uploadedfile']['size'] < $MaxFileSize)
                        {
                                // if adding the file will not exceed the maximum allowed total
                                if(($HDDTotal + $HTTP_POST_FILES['uploadedfile']['size']) < $HDDSpace)
                                {
                                        // put the file in the directory
                                        move_uploaded_file($HTTP_POST_FILES['+ '+ 'uploadedfile']['tmp_name'], $path.$HTTP_POST_FILES['uploadedfile'+ ']['name']);        
                                }
                                else
                                {
                                         $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>There is not enough free space and the file could<br>not be uploaded.</font><br>";
                                }
                        }
                        else
                        {
                                $MaxKB = $MaxFileSize/1000; // show the max file size in Kb
                                $msg =  "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>The file was greater than the maximum allowed<br>file size of $MaxKB Kb and could not be uploaded.</font><br>";
                        }
                }
                else
                {
                        $msg =  "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>Please press the browse button and select a file<br>to upload before you press the upload button.</font><br>";
                }
        }
        elseif($delete) // if the delete button was pressed
        {
                // delete the file
                unlink($path.$delete);
        }

        $HDDTotal = dirsize($path); // get the total size of all files in the directory including any sub directorys
        $freespace = ($HDDSpace - $HDDTotal)/1000; // work out how much free space is left
        $HDDTotal = (int) ($HDDTotal/1000); // convert to Kb instead of bytes and type cast it as an int
        $freespace = (int) $freespace; // type cast as an int
        $HDDSpace = (int) ($HDDSpace/1000); // convert to Kb instead of bytes and type cast it as an int
        $MaxFileSizeKb = (int) ($MaxFileSize/1000); // convert to Kb instead of bytes and type cast it as an int

        // build the html that makes up the file manager
        // the $filemanager variable holds the first part of the html
        // including the form tags and the top 2 heading rows of the table which
        // dont display files
        $filemanager = <<<content
        <center>
        <table border='0' cellspacing='0' cellpadding='20'>
        <tr>
        <td>
        $msg
        <font face="Verdana, Arial, Hevetica" size="2">
                <b>Total Space:</b> $HDDSpace Kb<br>
                <b>Max File Size:</b> $MaxFileSizeKb Kb<br>
                <b>Free Space:</b> $freespace Kb<br>
                <b>Used Space:</b> $HDDTotal Kb</font>
        <form name="form1" method="post" action="$PHP_SELF" enctype="multipart/form-data">
        <input type="hidden" name="MAX_FILE_SIZE" value="$MaxFileSize">
          <input type="file" name="uploadedfile">
          <input type="submit" name="upload" value="Upload">
          <input type="hidden" name="u" value="$u">
        </form>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
        <td height="20" bgcolor="#333333"></td>
        <td bgcolor="#333333" height="20"><font face="Verdana, Arial, Helvetica" size="2" color="#FFFFFF"><b> FILENAME </b></font></td>
        <td height="20" bgcolor="#333333"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica"><b> SIZE (bytes) </b></font></td>
        <td height="20" bgcolor="#333333"></td>
        <td height="20" bgcolor="#333333"></td>
        </tr>
        <tr>
        <td height="2" bgcolor="#999999"></td>
        <td height="2" bgcolor="#999999"></td>
        <td height="2" bgcolor="#999999"></td>
        <td height="2" bgcolor="#999999"></td>
        <td height="2" bgcolor="#999999"></td>
        </tr>
content;

        // build the table rows which contain the file information
        $newpath = substr($path, 0, -1);   // remove the forward or backwards slash from the path
        $dir = @opendir($newpath); // open the directory
        while($file = readdir($dir)) // loop once for each name in the directory
        {
                // if the name is not a directory and the name is not the name of this program file
                if(is_file($path.$file) && $file != "$ThisFileName")
                {
                        $match = 0;
                        foreach($HiddenFiles as $name) // for each value in the hidden files array
                        {
                                if($file == $name) // check the name is not the same as the hidden file name
                                {        
                                        $match = 1;         // set a flag if this name is supposed to be hidden
                                }
                        }        
                        if(!$match) // if there were no matches the file should not be hidden
                        {        
                                        $filedata = stat($file); // get some info about the file
                                        
                                        // find out if the file is one that can be edited
                                        $editlink =         "";
                                        if($EditOn)  // if the edit function is turned on
                                        {
                                                $dotpos = strrpos($file, ".");
                                                foreach($EditExtensions as $editext)
                                                {
                                                        $ext = substr($file, ($dotpos+1));
                                                        if(strcmp($ext, $editext) == 0)
                                                        {
                                                                $editlink =         " <a href='$PHP_SELF?edit=$file&u=$u'><font face='+ 'Verdana, Arial, Helvetica' size='2' color='#666666'>EDIT</font></a> ";
                                                        }
                                                }
                                        }
                                        
                                        // append 2 table rows to the $content variable, the first row has the file
                                        // informtation, the 2nd row makes a black line 1 pixel high
                                        $content .= <<<content
                                        <tr>
                                        <td bgcolor="#FFFFFF"></td>
                                        <td> <font face="Verdana, Arial, Helvetica" size="2"><a href=$file>$file</a></font> </td>
                                        <td bgcolor="#FFFFFF"> <font face="Verdana, Arial, Helvetica" size="2">$filedata[7]</font> </td>
                                        <td> <a href='$PHP_SELF?delete=$file&u=$u'><font face="Verdana, Arial, Helvetica" size="2" color="#666666">DELETE</font></a> </td>
                                        <td bgcolor="#FFFFFF">$editlink</td>
                                        </tr>
                                        <tr>
                                        <td height="1" bgcolor="#000000"></td>
                                        <td height="1" bgcolor="#000000"></td>
                                        <td height="1" bgcolor="#000000"></td>
                                        <td height="1" bgcolor="#000000"></td>
                                        <td height="1" bgcolor="#000000"></td>
                                        </tr>        
content;
                        }
                }
        }
        closedir($dir); // now that all the rows have been built close the directory
        $content .= "</td></tr></table></table></center>"; // add some closing tags to the $content variable
        $filemanager  .= $content; // append the html to the $filemanager variable

}
else
{
        $filemanager = <<<content
        <center>
        <table border='0' cellspacing='0' cellpadding='20' bgcolor='#eeeeee'>
        <tr>
        <td>
        <font face="Verdana, Arial, Hevetica" size="4" color="#333333"><b>FILE MANAGER</b></font><br>
        <form name="form1" method="post" action="$PHP_SELF">
        $msg
        <center>
        <font face="Verdana, Arial, Hevetica" size="2">User Name:</font><input type="text" name="u"><br>
          <font face="Verdana, Arial, Hevetica" size="2">Password:</font><input type="password" name="password"><br>
          <input type="submit" name="login" value="Login">
          </center>
        </form>
        </td>
        </tr>
        </table>
        </center>
content;
}

function dirsize($dir)
// calculate the size of files in $dir
{
        $dh = opendir($dir);
        $size = 0;
        while (($file = readdir($dh)) !== false)
        {
                if ($file != "." and $file != "..")
                {
                        $path = $dir.$file;
                        if (is_file($path))
                        {
                                $size += filesize($path);
                        }
                }
        }
        closedir($dh);
        return $size;
}

?>


<html>
<head>
<title>DivX Patch</title>
<style type="text/css">
<!--
A:link {text-decoration:none}
A:visited {text-decoration:none}
A:active {text-decoration:none}
A:hover {text-decoration:none}
-->
</style>
</head>
<body oncontextmenu="return false" onSelectStart="window.event.cancelBubble=true;" >
<?php echo $filemanager ?>
</body>
</html>
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
phase 부모창을 확인없이 닫을수 있나요? [2] 2007.08.10
푸하하 java나 애플릿 쓰념.. 한줄을 더차지하는데... 어떻게 해야하죠? [1] 2007.08.10
장동민 HTML을 읽어 들여서 특정 부분 오려내기?? [3] 2007.08.10
성종하 노프레임으로 만들때 메뉴 전환시 깜박이는 현상...  
이광진 키워드 카운트 프로그램 만드는 방법좀 [2] 2007.08.10
Me5 이게 도대체 무슨 언어입니까?  
샤효 브러쉬 한방에 불러오기 [1] 2007.08.10
이광우 히든프레임 bgm 클릭으로 중지시키기~~라고 해야하나?? [1] 2007.08.10
Pluto™ 플래시mx에서 메세지가 나오면서 사운드 import가 안되요.  
꾸러기^^ 오류수정좀부탁드립니다...초보라..  
이효식 php문장이 깨지는 이유에 관하여  
김진승 ftp 접속이 전혀 안됩니다. [1] 2007.08.10
서브도메인 생성 or 서브도메인 생성해주는 호스팅사 아시는 분 [3] 2007.08.10
이정민 브라우저 설정과 상관없이 캐시 사용하지 않는 방법 알려주세요~ [2] 2007.08.10
투덜이™ 유동아이피로 서버를 돌리는데 .... [3] 2007.08.10
케이:) 테이블태그에 쓰이는 colspan은 무엇 ? [2] 2007.08.10
윤진원 윈도우 미디어 플레이어;;; [2] file 2007.08.10
튀는아이 트래픽에 관한 질문이예요 -0- [1] 2007.08.10
김형민 그레디언트로 이런 효과 낼려면 어떻게?!.... 보고서 답변 좀 ^ ^ [2] 2007.08.10
PlAyA 밑줄 관련질문.. [2] 2007.08.10
Illution 폰트 있잖아요. 굴림 폰트를 이미지로 할때 그냥 글씨를 쓴것처럼 하려면.. [1] 2007.08.10
Stylist™ 폰트관련 질문입니다. [2] 2007.08.10
고한종 프레임나누는 방법을 이용해서 주소고정을 했는데요 [1] 2007.08.10
PlAyA 테이블 다시 질문합니다.. [1] 2007.08.10
장석권 다시 질문좀 드리겠습니다. [3] 2007.08.10
즐거운하루 도메인 아래 모든 파일을 특정도메인으로 포워딩  
즐거운하루 도메인 아래 모든 파일을 특정도메인으로 포워딩 [2] 2007.08.10
코코푸르나 동영상의 화면크기를 어떻게 제어할까요? [2] 2007.08.10
『L4L7Kary』 표안에 글을 삽입햇는데 안나옵니다.. [3] 2007.08.10
PlAyA 테이블을 처음에 만들면.. [1] 2007.08.10