⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 job_file_info.php

📁 开源的OA系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
session_start();
include "middle.php";
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;
	}
}

require_once  "../MessageBox.php";
$Message = new MessageBox;
if ( !empty($_SESSION["userid"]) ) { 
include "../datasource.inc.php";
$page             = $_REQUEST['page'];
$id               = $_REQUEST['id'];
$action           = $_REQUEST['action'];
$job_body         = str_replace("\n", "<BR>", $_REQUEST['job_body']);
$date             = Date("Y-m-j");	
$job_body1        = str_replace("\n", "<BR>", $_REQUEST['job_body1']);
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);
   $sql     = "insert into job_file (id,userid,name,job_date,job_name,job_path,job_fl,job_body) values ('','$_SESSION[userid]','$_REQUEST[name]','$_REQUEST[job_date]','$_REQUEST[job_name]','$file_name1','$_REQUEST[job_fl]','$job_body');";    
   $result  = mysql_query($sql);
   $Message->setMessage("添加成功!","job_file_info.php");
   $Message->showMessage();
}	
if ($_REQUEST['action'] == 'update' and $_SESSION["userjs"]=='0') {
   $sql     = "update job_file set job_body1='$job_body1' where id = '$_REQUEST[id]';";    
   $result  = mysql_query($sql);
   $Message->setMessage("回复成功!","job_file_info.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>&nbsp;&nbsp;<IMG height=14 
      src="../images/closedfold.gif" width=14>&nbsp;&nbsp;您当前的位置<BR>&nbsp;&nbsp;<IMG 
      height=15 src="../images/bar.gif" width=15>&nbsp;&nbsp;<IMG height=14 
      src="../images/openfold.gif" width=14>&nbsp;&nbsp;上报文件</FONT></TD>
        </tr>
</table>
<table width=766 border=0 cellpadding=0 cellspacing=0 align="right">
 <tr><td width=10 bgcolor=#3494d4 height=1></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
//if ($_SESSION['userid']=="admin") {
    //echo "<div align=center><a href=job_file_info.php>浏览文件</a></div>";
//}
switch ($page){
    case "add":
   // if ($_SESSION["userid"]=="admin") {

?>
<center>
<form enctype="multipart/form-data" name=form  method="post" action="job_file_info.php" onsubmit="return check_input()">
<table border=0 cellpadding=0 cellspacing=1 bgcolor=#333333 width=520>
  <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="70%" bgColor=#ffffff><textarea name="job_body" cols="60" rows="10"></textarea></td>
  </tr>  
</table><br>
<?php
echo "<input type=hidden value=$_SESSION[realname] name=name>";
echo "<input type=hidden value=$date name=job_date>";
?>
<input type="hidden" value="add" name="action">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="submit" value="提 交" >&nbsp;&nbsp;<input type="reset"  value="取 消">
</form>
</center>
<?  
    //}
    break;
	case "delete":
      if ( $_SESSION['userjs'] == "0" ) {
	     $query     = "delete from job_file where id='$id';";
         mysql_query($query);
         $Message->setMessage("删除成功!","job_file_info.php");
         $Message->showMessage();
	  } else {
         $Message->setMessage("不能删除!","javascript:window.close()");
         $Message->showMessage();	  
	  }
    break;
	case "update":
         $sql              = "select * from job_file where id='$id';";
         $result           = mysql_query($sql);
         $row              = mysql_fetch_array($result);
         $id               = $row['id'];
         $job_name         = $row['job_name'];
		 $job_body         = str_replace("<BR>", "\n", $row['job_body']);

?>
<form enctype="multipart/form-data" name=form  method="post" action="job_file_info.php" onsubmit="return check_input()">
<center>
<table border=0 cellpadding=0 cellspacing=0 width=776>
 <tr><td width=10 bgcolor=#ffffff>&nbsp;</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>
   &nbsp;<?php echo $row['name']; ?>
	</font>
    </td>
  </tr>
  <tr height=24> 
    <td width="15%" bgColor=#ffffff align=center>上报时间</td>
    <td width="85%" bgColor=#ffffff > 
    &nbsp;<?php echo $row['job_date']; ?>
    </td>
  </tr>
  <tr height=24> 
    <td width="15%" bgColor=#ffffff align=center>文件名称</td>
    <td width="85%" bgColor=#ffffff > 
 &nbsp;<?php echo $row['job_name']; ?>
    </td>
  </tr>
  <tr height=24> 
    <td width="15%" bgColor=#ffffff align=center>下载</td>
    <td width="85%" bgColor=#ffffff > 
    &nbsp;<?php
	$path0     = "../upload-files";
	$path1     = $row['job_path'];
	$filepath = "$path0/$path1";
	echo "<a href=\"?downfile=".urlencode($filepath)."\">下载</a>"; 
		
	
	?>    </td>
  </tr>
  <tr height=24> 
    <td width="15%" bgColor=#ffffff align=center>所属分类</td>
    <td width="85%" bgColor=#ffffff > 
&nbsp;<?php echo $row['job_fl']; ?>
    </td>
  </tr>
  <tr> 
    <td width="15%" bgColor=#ffffff align=center>文件描述</td>
    <td width="70%" bgColor=#ffffff>
	&nbsp;<?php echo "<textarea name=job_body cols=60 rows=10>$job_body</textarea>";?>	
	</td>
  </tr>  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -