+++ .idea/php.xml
... | ... | @@ -0,0 +1,4 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project version="4"> | |
3 | + <component name="PhpProjectSharedConfiguration" php_language_level="7.2" /> | |
4 | +</project>(No newline at end of file) |
--- config/download.php
+++ config/download.php
... | ... | @@ -1,31 +1,37 @@ |
1 | 1 |
<?php |
2 |
-include("db.config.php"); |
|
2 |
+ include("db.config.php"); |
|
3 |
+ ini_set("display_errors",0); |
|
3 | 4 |
|
4 |
-$filepath = "/home/hw/www/download/"; |
|
5 |
-$file = $_GET['file']; |
|
6 |
-$down = $filepath.$file; |
|
7 |
-$filesize = filesize($down); |
|
5 |
+ $filepath = "/home/hw/www/download/"; |
|
6 |
+ $file = $_GET['file']; |
|
7 |
+ $down = $filepath.$file; |
|
8 |
+ $filesize = filesize($down); |
|
8 | 9 |
|
9 |
-//파일 다운로드 |
|
10 |
-if(file_exists($down)){ //파일의 존재여부 확인 |
|
11 |
- header("Content-Type:application/octet-stream"); |
|
12 |
- header("Content-Disposition:attachment;filename=$file"); //다운로드 대화상자 띄움 |
|
13 |
- header("Content-Transfer-Encoding:binary"); //인코딩 형식 지정정 |
|
14 |
- header("Content-Length:".filesize($filepath.$file)); //업로드한 파일 크기 |
|
15 |
- header("Cache-Control:cache,must-revalidate"); //캐싱 방지 |
|
16 |
- header("Pragma:no-cache"); //캐싱 방지 |
|
17 |
- header("Expires:0"); //캐싱 방지 |
|
18 | 10 |
|
19 |
- if(is_file($down)){ //파일의 존재여부 확인 |
|
20 |
- $openFile = fopen($down,"r"); //파일 열기 , r : 읽기전용 |
|
21 |
- while(!feof($openFile)){ //파일 내용끝날때 까지 |
|
22 |
- $buf = fread($openFile,8192);//파일 읽기, 8192byte |
|
23 |
- $read = strlen($buf); |
|
24 |
- print($buf); |
|
25 |
- flush(); //출력버퍼를 비움 |
|
11 |
+ //파일 다운로드 |
|
12 |
+ if(file_exists($down)){ //파일의 존재여부 확인 |
|
13 |
+ header("Content-Type:application/octet-stream"); |
|
14 |
+ header("Content-Disposition:attachment;filename=$file"); //다운로드 대화상자 띄움 |
|
15 |
+ header("Content-Transfer-Encoding:binary"); //인코딩 형식 지정정 |
|
16 |
+ header("Content-Length:".filesize($filepath.$file)); //업로드한 파일 크기 |
|
17 |
+ header("Cache-Control:cache,must-revalidate"); //캐싱 방지 |
|
18 |
+ header("Pragma:public"); //캐싱 방지 |
|
19 |
+ header("Expires:0"); //캐싱 방지 |
|
20 |
+ |
|
21 |
+ if(is_file($down)){ //파일의 존재여부 확인 |
|
22 |
+ $openFile = fopen($down,"r"); //파일 열기 , r : 읽기전용 |
|
23 |
+ while(!feof($openFile)){ //파일 내용끝날때 까지 |
|
24 |
+ $buf = fread($openFile,8192);//파일 읽기, 8192byte |
|
25 |
+ $read = strlen($buf); |
|
26 |
+ print($buf); |
|
27 |
+ flush(); //출력버퍼를 비움 |
|
28 |
+ } |
|
29 |
+ fclose($openFile); //파일 닫기 |
|
26 | 30 |
} |
27 |
- fclose($openFile); //파일 닫기 |
|
28 |
- } |
|
29 |
-} else{?> |
|
30 |
- <script>alert("존재하지 않는 파일입니다.")</script> |
|
31 |
-<?php}(No newline at end of file) |
|
31 |
+ else{ |
|
32 |
+ echo "None file"; |
|
33 |
+ } |
|
34 |
+ } else{ |
|
35 |
+ echo "<script>alert('존재하지 않는 파일입니다.')</script>"; |
|
36 |
+ echo "<meta http-equiv='refresh' content='0.1; url=../view.php?whereValue=". $_GET['whereValue']."&option=".$_GET['option']."&searchText=".$_GET['text']."'>"; |
|
37 |
+ }(No newline at end of file) |
--- view.php
+++ view.php
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 |
.pwText {width: 100px;} |
41 | 41 |
#answerPrint {border-bottom: white solid 10px; width: 100%;} |
42 | 42 |
#changedContent {width: 60%; height: 50px; display: inline;} |
43 |
- #answerTitle {width: 100%; text-align: center; font-weight: bolder; font-size: larger; border-top: white solid 10px;} |
|
43 |
+ #answerTitle {width: 100%; text-align: center; font-weight: bolder; border-top: white solid 10px;} |
|
44 | 44 |
.replyForm {text-align: right; padding-right: 25%;} |
45 | 45 |
.replyBtn {font-weight: bolder; background-color: tomato; border-style: none; color: white; height: 25px; width: 45px;} |
46 | 46 |
.replyBtn:hover {background-color: black;} |
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 |
<p id="contents"><?php echo $row['contents']; ?></p> |
78 | 78 |
</div> |
79 | 79 |
<div id="file"> |
80 |
- <br>첨부파일 : <a href="config/download.php?file=<?php echo $row['file']?>"><?php echo $row['file'];?></a> |
|
80 |
+ <br>첨부파일 : <a href="config/download.php?file=<?php echo $row['file']?>&whereValue=<?php echo $row['num']?>&option=<?php echo $_GET['option']?>&searchText=<?php echo $text?>"><?php echo $row['file'];?></a> |
|
81 | 81 |
</div> |
82 | 82 |
<div id="btnControl"> |
83 | 83 |
<button class="btnS" id="btnUpdate" onclick="location.href='updateWrite.php?whereValue=<?php echo $row['num'];?>&option=<?php echo $_GET['option']?>&searchText=<?php echo $text?>'">수정</button> |
... | ... | @@ -94,7 +94,7 @@ |
94 | 94 |
<input class="btnS" type="submit" value="확인"> |
95 | 95 |
</form> |
96 | 96 |
</div> |
97 |
- <h2><span id="answerTitle">댓글</span></h2> |
|
97 |
+ <h2 id="answerTitle">댓글</h2> |
|
98 | 98 |
<div id="answerSelect"> |
99 | 99 |
<?php |
100 | 100 |
if(!$result){ |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?