?? job_file1.php
字號:
<?
session_start();
if (!empty($downfile)) {
if (!@file_exists($downfile)) {
echo "<script>alert('你要下的文件不存在!')</script>";
//echo "下載出錯";
} else {
$filename = basename($downfile);
$filename_info = explode('.', $filename);
$fileext = $filename_info[count($filename_info)-1];
header('Content-type: application/x-'.$fileext);
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Description: PHP Generated Data');
header('Content-Length: '.filesize($downfile));
@readfile($downfile);
exit;
}
}
include "middle.php";
require_once "../MessageBox.php";
$Message = new MessageBox;
?>
<link href="../css/a1.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0">
<table width="789" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="../images/home_12.jpg" width="789" height="12"></td>
</tr>
<tr>
<td width="776" valign="top">
<?php
if ( !empty($_SESSION["userid"]) ) {
include "../datasource.inc.php";
$page = $_REQUEST['page'];
$id = $_REQUEST['id'];
$action = $_REQUEST['action'];
$date = Date("Y-m-j");
if (! ($_SESSION['userid'] == "0") ) {
$sql = "select * from job_file where userid='$_SESSION[userid]' order by id desc;";
$result = mysql_query($sql);
for ( $i=0;$i<2;$i++ ) {
$row = mysql_fetch_array($result);
if ($_SESSION['read'] == "1" ) {
break;
} else {
if ( $row['job_body1'] ) {
echo "
<script language=javascript1.2>
window.open(\"../news.html\",'_blank','top=3,right=60,height=120,width=140,toolbar=0,menubar=0,scrollbars=0,resizable=0,status=0');
</script>";
$_SESSION['read'] = "1";
}
}
}
}
if ($action == 'add') {
$file_name01 = $_FILES['job_path']['name'];
mt_srand((double)microtime()*1000000);
$shpid = uniqid(mt_rand());
$shpid = substr($shpid,0,8);
$file_name1 = $shpid.$file_name01;
$picpath1 = $path.$file_name1;
copy($HTTP_POST_FILES['job_path']['tmp_name'],$picpath1);
$shpidfilename = $shpid.".".substr($file_name01,-3);
@rename("$path/$file_name1","$path/$shpidfilename");
$sql = "insert into job_file (id,userid,name,job_date,job_name,job_path,job_fl,job_body,department) values ('','$_SESSION[userid]','$_REQUEST[name]','$_REQUEST[job_date]','$_REQUEST[job_name]','$shpidfilename','$_REQUEST[job_fl]','$job_body','$_SESSION[department]');";
$result = mysql_query($sql);
$Message->setMessage("添加成功!","job_file1.php");
$Message->showMessage();
}
?>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<TD vAlign=top><FONT color=#565656> <IMG height=14
src="../images/closedfold.gif" width=14> 您當前的位置<BR> <IMG
height=15 src="../images/bar.gif" width=15> <IMG height=14
src="../images/openfold.gif" width=14> 上報文件</FONT></TD>
</tr>
</table>
<table width=766 border=0 cellpadding=0 cellspacing=0 align=right>
<tr><td width=766 height=1 bgcolor=#3494d4></td>
</tr></table>
<script language=javascript>
function check_input()
{
if (document.form.job_name.value=='') {
alert("請輸入文件名稱!");
return false;
}
if (document.form.job_body.value=='') {
alert("請輸入文件描述!");
return false;
}
return true;
}
</script>
<br>
<?php
//echo "<div align=right><a href=job_file1.php>瀏覽文件</a>  <a href=job_file1.php?page=add>上報文件</a></div>";
switch ($page){
case "add":
// if ($_SESSION["userid"]=="admin") {
?>
<center>
<form enctype="multipart/form-data" name=form method="post" action="job_file1.php" onsubmit="return check_input()">
<table border=0 cellpadding=0 cellspacing=0 width=776>
<tr><td width=10 bgcolor=#ffffff> </td>
<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>
<tr height=24>
<td width="15%" bgColor=#ffffff align=center>上報人</td>
<td width="85%" bgcolor=ffffff> <font color=red>
<?php echo $_SESSION['realname']; ?>
</font>
</td>
</tr>
<tr height=24>
<td width="15%" bgColor=#ffffff align=center>上報時間</td>
<td width="85%" bgcolor=ffffff>
<?php echo $date; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center>文件名稱</td>
<td width="85%" bgcolor=ffffff>
<input type="text" size="30" name="job_name" maxlength="40">
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center>上傳文件</td>
<td width="85%" bgcolor=ffffff>
<input type="file" size="20" name="job_path">
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center>文件描述</td>
<td width="85%" bgColor=#ffffff> <textarea name="job_body" cols="60" rows="10"></textarea></td>
</tr>
</table></td></table><br>
<?php
echo "<input type=hidden value=$_SESSION[realname] name=name>";
echo "<input type=hidden value=$date name=job_date>";
echo "<input type=hidden value=$_SESSION[department] name=department>";
?>
<input type="hidden" value="add" name="action">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="submit" name="submit" value=" 確 定 "> <input type="reset" name="submit1" value=" 重 置 ">
</form>
</center>
<?php
break;
default:
echo "<center>";
echo "<form action=job_file1.php method=post>";
echo "<table border=0 width=776>";
echo "<tr>";
echo "<td width=10 bgcolor=#ffffff> </td>";
echo "<td bgColor=#ffffff align=left>";
echo "文檔名:<input type=text size=20 name=search maxlength=20>";
echo " <input type=submit value=\"搜 索\">";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
if ($_REQUEST['search']){
$sql = "select * from job_file where name='$_SESSION[realname]' and job_name like '%$_REQUEST[search]%' order by id desc;";
} else {
$sql = "select * from job_file where name='$_SESSION[realname]' order by id desc;";
}
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/40)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*40);
echo "<table border=0 cellpadding=0 cellspacing=0 width=776>";
echo "<tr><td width=10 bgcolor=#ffffff> </td>";
echo "<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>";
echo "<tr height=24>";
echo "<td width=150 bgColor=#3494d4><div align=center><font color=#ffffff><b>上報人</b></font></div></td>";
echo "<td width=150 bgColor=#3494d4><div align=center><font color=#ffffff><b>上報時間</b></font></div></td>";
echo "<td width=200 bgColor=#3494d4><div align=center><font color=#ffffff><b>文件名稱</b></font></div></td>";
echo "<td width=58 bgColor=#3494d4><div align=center><font color=#ffffff><b>查看</b></font></div></td>";
echo "<td width=58 bgColor=#3494d4><div align=center><font color=#ffffff><b>下載</b></font></div></td>";
echo "<td width=150 bgColor=#3494d4><div align=center><font color=#ffffff><b>管理員回復</b></font></div></td>";
echo "</tr>";
for ( $i=0;$i<40;$i++ ) {
$row = mysql_fetch_array($result);
$id = $row['id'];
$job_body = substr($row['job_body'],0,30);
if ( $id ) {
echo "<tr bgColor=#ffffff height=22>";
echo "<td width=150 bgColor=#ffffff><div align=center>$row[name]</div></td>";
echo "<td width=150 bgColor=#ffffff><div align=center>$row[job_date]</div></td>";
echo "<td width=200 bgColor=#ffffff><div align=center>$row[job_name]</div></td>";
echo "<td width=58 bgColor=#ffffff><div align=center><a href=# onClick=\"window.open('job_file_show.php?id=$row[id]',1,'top=50,left=50,height=500,width=500,scrollbars=yes')\">查看</a></div></td>";
$path0 = "../upload-files";
$path1 = $row['job_path'];
$filepath = "$path0/$path1";
echo "<td width=58 bgColor=#ffffff><div align=center><a href=\"?downfile=".urlencode($filepath)."\">下載</a></div></td>";
if ( $row['job_body1'] ) {
echo "<td width=150 bgColor=#ffffff><div align=center><font color=red>是</font>(<a title=點擊查看回覆 href=job_file1.php?page=text&id=$row[id]>查看</a>)</div></div></td>";
} else {
echo "<td width=150 bgColor=#ffffff><div align=center>否</div></div></td>";
}
echo "</tr>";
}
}
echo "</table></td></table><br>";
echo "<table width=500 border=0 cellspacing=0 cellpadding=0 height=24>";
echo "<tbody>";
echo "<tr><td><center>";
echo "總共找到<font color=red>$num</font>條記錄,第<font color=red>$page</font>頁,共<font color=red>$last</font>頁。";
echo "</center></td></tr><tr>";
if ( $page <> 1 ) {
echo "<td align=center> <a href=job_file1.php?page=1>第一頁</a></td>";
echo "<td align=center><a href=job_file1.php?page=".($page-1).">上一頁</a></td>";
}
if ( $page <> $last ) {
echo "<td align=center><a href=job_file1.php?page=".($page+1).">下一頁</a></td>";
echo "<td align=center><a href=job_file1.php?page=$last>最后一頁</a></td>";
}
echo "</tbody>";
echo "</tr>";
echo "</table><br>";
echo "</center>";
} else {
echo "<center>對不起,找不到符合條件的記錄!</center>";
}
break;
}
} else {
$Message->setMessage("對不起,您沒有權限進入后臺管理!","index.php");
$Message->showMessage();
}
?>
</td>
<td width="13" align="right" background="../images/home_16.jpg" height="457"> </td>
</tr>
<tr>
<td height="8" colspan="2" valign="top"><img src="../images/home_24.jpg" width="789" height="8"></td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -