-
Notifications
You must be signed in to change notification settings - Fork 3
/
fileinfo.php
94 lines (85 loc) · 2.61 KB
/
fileinfo.php
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
<?php
require_once('functions.php');
require_once('auth_head.php');
?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<?php
$subject = safeGet('subject');
$file = safeGet('file');
$dbc= newDbc();
if($file !=NULL)
$result =db_select("resource","subject='".$subject."' and date='".$file."'");
else
{
$fileName =safeGet('fileName');
$result =db_select("resource","subject ='".$subject."' and name='".$fileName."'");
}
if($result==false ||$result->num_rows == 0)
{
echo "没有这个文件,或者该资源已经被管理员删除";
exit;
}
else
{
$row = mysqli_fetch_array($result);
$fileName =$row['name'];
$file =$row['date'];
$uploader =$row['user'];
$downloadTimes = $row['downloadtimes'];
$description =$row['description'];
echo'
<h3>'.$fileName;
echo " <a class='btn btn-small' href='download.php?subject=".$subject."&file=".$file."'> <i class='icon-download-alt'></i> 下载</a>";
echo '</h3>
</div>
<div class="modal-body" style="max-height:470px;">
<h4>上传者:'.$uploader.'</h4>
<h4>下载次数:'.$downloadTimes.'</h4>
<h4>资源描述</h4>
';
if($description =='')
echo "空";
else
echo $description;
echo "
<h4>资源评论</h4>
";
$query = "SELECT comment.subject,comment.file,comment.time,comment.content,user.nickname FROM comment,user
where comment.user=user.name and
subject ='".$subject."' and file='".$fileName."'
ORDER BY comment.time DESC;";
$comment =mysqli_query($dbc,$query);
if($comment ->num_rows == 0)
echo "暂无评论!";
else
{
echo " <table class='table table-hover '> <tbody> ";
for($i=0;$i<$comment->num_rows;$i++)
{
$row=mysqli_fetch_array($comment);
echo "<tr><td><p><big>".$row['nickname']."</big> ".date("m/d H:i",$row['time'])."</p>";
echo "<p>".$row['content']."</p></td></tr>";
}
echo " </tbody></table>";
}
}
?>
<hr />
<iframe style="display:none;" name="addComment">
</iframe>
<form onSubmit=" setTimeout(show,500);
function show()
{
<?php
echo"loadComment('fileinfo.php?subject=".$subject."&file=".$file."');";
?>
}
" action="addComment.php" target="addComment" method="post">
<input name="file" value="<?php echo $fileName ?>" type="hidden" />
<input name="subject" value="<?php echo $subject ?>" type="hidden" />
<textarea name="content" rows="3" style="width:90%"></textarea>
<br />
<input type="submit" class="btn " value="发布" />
</form>
</div>