📄 job_job1.php
字号:
<?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;
}
}
//session_start();
include "middle.php";
require_once "../MessageBox.php";
$Message = new MessageBox;
if ( !empty($_SESSION["userid"]) ) {
include "../datasource.inc.php";
$date = Date("Y-m-j");
$page = $_REQUEST['page'];
$id = $_REQUEST['id'];
$action = $_REQUEST['action'];
$job_body = str_replace("\n", "<BR>", $_REQUEST['job_body']);
$job_body1 = str_replace("\n", "<BR>", $_REQUEST['job_body1']);
if (! ($_SESSION["userjs"]=='0') and ! ($_SESSION["userjs"]=='2') ) {
$sql = "select * from job_job 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_job (id,userid,job_name,job_date,job_type,job_body,department,job_path) values ('','$_SESSION[userid]','$_REQUEST[job_name]','$_REQUEST[job_date]','$_REQUEST[job_type]','$job_body','$_SESSION[department]','$shpidfilename');";
$result = mysql_query($sql);
$Message->setMessage("添加成功!","job_job1.php");
$Message->showMessage();
}
if ($action == 'update') {
$sql = "update job_job set job_body1='$job_body1' where id = '$_REQUEST[id]';";
$result = mysql_query($sql);
$Message->setMessage("回覆成功!","job_job1.php");
$Message->showMessage();
}
?>
<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">
<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 cellspacing=0 cellpadding=0 align=right>
<tr>
<td width=766 height=1 bgcolor=#3494d4></td>
</tr>
</table><br>
<script language=javascript>
function check_input()
{
if (document.form.job_body.value=='') {
alert("请输入内容!");
return false;
}
return true;
}
</script>
<?php
switch ($page){
case "add":
?>
<center>
<form enctype="multipart/form-data" name=form method="post" action="job_job1.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 height=24>
<td width="15%" bgColor=#ffffff align=center>工作情况</td>
<td width="85%" bgcolor=ffffff> <select name=job_type>
<?php
echo "<option value=每天计划>每天计划</option>";
echo "<option value=下周计划>下周计划</option>";
echo "<option value=每天总结>每天总结</option>";
echo "<option value=一周总结>一周总结</option>";
?>
</select>
</td>
</tr>
<tr>
<td width="15%" bgcolor=#ffffff align="center" height=24>上传文件</td>
<td width="85%" bgcolor=#ffffff>
<input type="file" name="job_path" size="20"></td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center>总结内容</td>
<td width="85%" bgColor=#ffffff> <textarea name="job_body" cols="65" rows="10"></textarea></td>
</tr>
</table></td></table><br>
<input type="hidden" value="add" name="action">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<?php
echo "<input type=hidden value=$_SESSION[realname] name=job_name>";
echo "<input type=hidden value=$date name=job_date>";
?>
<input type="hidden" value="add" name="action">
<input type="hidden" value="<? $_SESSION['department'] ?>" name="department">
<input type="image" src="../images/images/3.gif" > <a href="job_job1.php?page=add"><img src="../images/images/4.gif" border="0"></a>
</form>
</center>
<?
break;
case "delete":
/*$sql = "select * from job_kf where id='$id';";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$dele = `rm $row['job_pic1']`;
$dele = `rm $row['job_pic2']`;
$dele = `rm $row['job_pic3']`;
$dele = `rm $row['job_pic4']`;
*/
$query = "delete from job_job where id='$id';";
mysql_query($query);
$Message->setMessage("删除成功!","job_job1.php");
$Message->showMessage();
break;
case "text":
$sql = "select * from job_job where id='$id';";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<br>
<center>
<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=#3493d4 width=766 >
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>填表人</td>
<td width="85%" bgcolor=ffffff> <?php echo $row['job_name']; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>填表时间</td>
<td width="85%" bgcolor=ffffff> <?php echo $row['job_date']; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>工作情况</td>
<td width="85%" bgcolor=ffffff> <?php echo $row['job_type']; ?>
</td>
</tr>
<tr>
<td width="15%" bgcolor=#ffffff align="center" height=24>下载</td>
<td width="85%" bgcolor=#ffffff>
<?
$path0 = "../upload-files";
$path1 = $row['job_path'];
$filepath = "$path0/$path1";
echo "<a href=\"?downfile=".urlencode($filepath)."\">下载</a>";
?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>总结内容</td>
<td width="85%" bgcolor=ffffff> <?php
$body = str_replace("<BR>", "\n", $row['job_body']);
echo $body;
?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>管理员回覆</td>
<td width="85%" bgcolor=ffffff> <font color=red>
<?php
$body1 = str_replace("<BR>", "\n", $row['job_body1']);
echo $body1;
?>
</font>
</td>
</tr>
</table>
</td>
</table>
<br><a href="job_job1.php">返回</a>
</center>
<?php
break;
case "return":
$sql = "select * from job_job where id='$id';";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<br>
<center>
<form action=job_job1.php method=post>
<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 height=200>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>填表人</td>
<td width="85%" bgcolor=ffffff>
<?php echo $row['job_name']; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>填表时间</td>
<td width="85%" bgcolor=ffffff>
<?php echo $row['job_date']; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>工作情况</td>
<td width="85%" bgcolor=ffffff>
<?php echo $row['job_type']; ?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>总结内容</td>
<td width="85%" bgcolor=ffffff>
<?php
$body = str_replace("<BR>", "\n", $row['job_body']);
echo $body;
?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center height=24>管理员回覆</td>
<td width="85%" bgcolor=ffffff>
<textarea name="job_body1" cols="50" rows="10">
<?php
$body1 = str_replace("<BR>", "\n", $row['job_body1']);
echo $body1;
?>
</textarea>
</td>
</tr>
</td>
</tr>
</table></td></tr></table><br>
<?php
echo "<input type=\"hidden\" name=\"id\" value=\"$row[id]\">"
?>
<input type="image" src="../images/images/3.gif" > <a href="job_job1.php?page=return&id=<? echo $row['id']?>"><img src="../images/images/4.gif" border="0"></a>
<input type="hidden" name="action" value="update">
</form>
</center>
<?php
break;
default:
/* echo "<center>";
echo "<form action=job_job1.php method=post>";
echo "<table border=0 width=776 cellpadding=0 cellspacing=0>";
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_job where (( job_name like '%$_REQUEST[search]%') and (userid='$_SESSION[userid]') ) order by id desc;";
} else {
$sql = "select * from job_job where userid='$_SESSION[userid]' 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=100 bgColor=#3494d4 align=center><font color=#ffffff><b>填表人</b></font></td>";
echo "<td width=100 bgColor=#3494d4 align=center><font color=#ffffff><b>填表时间</b></font></td>";
echo "<td width=173 bgColor=#3494d4 align=center><font color=#ffffff><b>工作情况</b></font></td>";
echo "<td width=153 bgColor=#3494d4 align=center><font color=#ffffff><b>浏览内容</b></font></td>";
echo "<td width=120 bgColor=#3494d4 align=center><font color=#ffffff><b>管理员回复</b></font></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>";
echo "<td width=100 height=22 bgColor=#ffffff><div align=center>$row[job_name]</div></td>";
echo "<td width=100 height=22 bgColor=#ffffff><div align=center>$row[job_date]</div></td>";
echo "<td width=173 height=22 bgColor=#ffffff><div align=center>$row[job_type]</div></td>";
echo "<td width=153 height=22 bgColor=#ffffff><div align=center><a href=# onClick=\"window.open('job_job_show.php?id=$row[id]',1,'top=50,left=50,height=450,width=450,scrollbars=yes')\">浏览内容</a></div></td>";
if ( $row['job_body1'] ) {
echo "<td width=120 height=22 bgColor=#ffffff><div align=center><font color=red>是</font>(<a title=点击查看回覆 href=# onClick=\"window.open('job_job_show.php?id=$row[id]',1,'top=50,left=50,height=450,width=450,scrollbars=yes')\">查看</a>)</div></div></td>";
} else {
echo "<td width=120 height=22 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_job1.php?page=1>第一页</a></td>";
echo "<td align=center><a href=job_job1.php?page=".($page-1).">上一页</a></td>";
}
if ( $page <> $last ) {
echo "<td align=center><a href=job_job1.php?page=".($page+1).">下一页</a></td>";
echo "<td align=center><a href=job_job1.php?page=$last>最后一页</a></td>";
}
echo "</tbody>";
echo "</tr>";
echo "</table><br>";
echo "</center>";
} else {
echo "<center>对不起,您还没有添加记录,<a href=job_job1.php?page=add>我要添加</a>!</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"></td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -