找回密码
 注册
广告投放 虚位以待【阿里云】2核2G云新老同享 99元/年,续费同价做网站就用糖果主机-sugarhosts.comJtti.com-新加坡服务器,美国服务器,香港服务器
查看: 788|回复: 19

谁有可以上传附件的程序???通过后台!!提供下!谢谢!!

[复制链接]
发表于 2006 年 1 月 24 日 19:10:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
  只要可以管理附件就可以了!
谢谢
压缩文件!!!!!!!!!!
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
发表于 2006 年 1 月 24 日 19:12:31 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
pm--VBVS吧!呵呵~
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:14:12 | 显示全部楼层
1.我自己修改美化的一个
  1. <?php
  2. error_reporting(0);
  3. function upfile($file_var,$tofile,$filepath){
  4.    if(!is_writable($filepath)){
  5.        echo"$filepath 目录不存在或不可写";
  6.        return false;
  7.        exit;
  8.    }
  9.    //echo $_FILES["$file_var"]['name'];
  10.    $Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1);
  11.    ($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile.".".$Filetype);//文件名
  12.     $Array[tofile] = $tofile.'.'.$Filetype;
  13.     $Array[oldfile]= $_FILES["$file_var"]['name'];
  14.    if(!($uploadfile==='')){
  15.        if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){
  16.             echo $_FILES["$file_var"]['tmp_name']." 上传失败.";
  17.             return false;
  18.             exit;
  19.        }
  20.        if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){
  21.             echo "上传失败。错误信息:\n";
  22.             print_r($_FILES);
  23.             exit;
  24.             }else{
  25.             return $Array;
  26.             }
  27.    }else{
  28.        return false;
  29.    echo"无法上传";
  30.    }
  31. }
  32. function getSize(&$fs)
  33. {
  34.    if($fs<1024)
  35.        return $fs."Byte";
  36.    elseif($fs>=1024&&$fs<1024*1024)
  37.        return @number_format($fs/1024, 3)." KB";
  38.    elseif($fs>=1024*1024 && $fs<1024*1024*1024)
  39.        return @number_format($fs/1024*1024, 3)." M";
  40.    elseif($fs>=1024*1024*1024)
  41.        return @number_format($fs/1024*1024*1024, 3)." G";
  42. }
  43. if ($_GET['downfile']) {
  44.    $downfile=$_GET['downfile'];
  45.    if (!@is_file($downfile)) {
  46.        echo "<script>alert(\"你要下载的文件不存在\")</script>";
  47.    }
  48.    $filename = basename($downfile);
  49.    $filename_info = explode('.', $filename);
  50.    $fileext = $filename_info[count($filename_info)-1];
  51.    header('Content-type: application/x-'.$fileext);
  52.    header('Content-Disposition: attachment; filename='.$filename);
  53.    header('Content-Description: PHP3 Generated Data');
  54.    readfile($downfile);
  55.    exit;
  56. }
  57. if(@$_GET['delfile']!="") {
  58.    $delfile=$_GET['delfile'];
  59.    if(file_exists($delfile)) {
  60.        @unlink($delfile);
  61.    } else {
  62.        $exists="1";
  63.        echo "<script>alert(\"文件已不存在\")</script>";
  64.    }
  65.    if(!file_exists($delfile)&&$exists!="1") {
  66.        echo"<script>alert(\"删除成功\")</script>";
  67.    } else {
  68.        echo"<script>alert(\"删除失败\")</script>";
  69.    }
  70. }
  71. $CurrentPath    = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false);
  72. if($CurrentPath===false)
  73. {
  74.    $CurrentPath    = dirname(__FILE__);
  75. }
  76. $CurrentPath    = realpath(str_replace('\\','/',$CurrentPath));
  77. if($_POST['dirname'])
  78. {
  79.    $newdir    = $CurrentPath."/".$_POST['dirname'];
  80.    if(is_dir($newdir))
  81.    {
  82.        echo"<script>alert(\"此目录名已经存在!\")</script>";
  83.        exit;
  84.    }else {
  85.        if(mkdir($newdir,0700))
  86.        {
  87.            echo"<script>alert(\"创建成功!\")</script>";
  88.        }else {
  89.            echo "<script>alert(\"创建失败!\")</script>";
  90.        }
  91.    }
  92. }
  93. if($_POST['upload'])
  94. {
  95.    if(!(upfile("upfiles",$_POST['fname'],$CurrentPath)))
  96.    {
  97.        echo"<script>alert(\"上传失败!\")</script>";
  98.    }else {
  99.        echo "<script>alert(\"上传成功!\")</script>";
  100.    }
  101. }
  102. ?>
  103. <!--nobanner--><html>
  104. <head>
  105. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  106. <title>file</title>
  107. <style type="text/css">
  108. <!--
  109. body{margin-left: 0px}
  110. td {font-family: "宋体"; font-size: 9pt; color: #666666; text-decoration: none}
  111. input {border-width: 1pix; border-style: solid; border-color: #cccccc}
  112. .title { border: 1px solid #000000; background-color: #6699cc; height: 25px; font-weight: bold; line-height: 150%; color: #ffffff}
  113. .content { border: 1px solid #000000; background-color: #f5f9fd}
  114. -->
  115. </style>
  116. </head>
  117. <body>
  118. <table width="760" border="0" align="center" cellpadding="3" cellspacing="3">
  119.   <tr>
  120.    <td class="title">PHP版本: <?php echo PHP_VERSION;?></td>
  121.   </tr>
  122.   <tr>
  123.    <td class="content">
  124.      <table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0">
  125.        <tr>
  126.          <form name="form2" method="post" action="">
  127.            <td><strong>新建目录: </strong><input name="dirname" type="text" id="dirname"> <input type="submit" name="submit" value="创 建"></td>
  128.          </form>
  129.        </tr>
  130.      <form name="form3" method="post" action="" enctype="multipart/form-data">
  131.        <tr>
  132.          <td><strong>上传文件: </strong><input name="upfiles" type="file" id="upfiles"></td>
  133.        </tr>
  134.        <tr>
  135.          <td><strong>新文件名: </strong><input name="fname" type="test" id="fname"> <input type="submit" name="upload" value="上 传"></td>
  136.        </tr>
  137.      </form>
  138.        <tr>
  139.          <td><strong>当前路径: </strong><?php echo $CurrentPath;?></td>
  140.        </tr>
  141.      </table>
  142.    </td>
  143.   </tr>
  144. </table>
  145. <table width="760" border="0" align="center" cellpadding="3" cellspacing="3">
  146.   <tr>
  147.    <td class="title">目录</td>
  148.   </tr>
  149.   <tr>
  150.    <td class="content">
  151.      <table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
  152. <?php
  153. $fso=@opendir($CurrentPath);
  154. while ($file=@readdir($fso)) {
  155.    $fullpath    = "$CurrentPath/$file";
  156.    $is_dir        = @is_dir($fullpath);
  157.    if($is_dir=="1"){
  158.    if($file!=".."&&$file!=".")    {
  159.        echo "<tr>\n";
  160.        echo "  <td>【目录】 <a href=\"?path=".urlencode($CurrentPath)."/".urlencode($file)."\">$file</a></td>\n";
  161.        echo "</tr>\n";
  162.    } else {
  163.        if($file=="..")
  164.        {
  165.            echo "<tr>\n";
  166.            echo "<td>【上级】 <a href=\"?path=".urlencode($CurrentPath)."/".urlencode($file)."\">上级目录</a></td>";
  167.            echo "</tr>\n";
  168.        }
  169.    }
  170.    }
  171. }
  172. @closedir($fso);
  173. ?>
  174.      </table>
  175.    </td>
  176.   </tr>
  177.   <tr>
  178.    <td class="title">文件列表</td>
  179.   </tr>
  180.   <tr>
  181.    <td class="content">
  182.      <table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
  183.        <tr bgcolor="#eef2f7">
  184.          <td><b>文件名</b></td>
  185.          <td><b>修改日期</b></td>
  186.          <td><b>文件大小</b></td>
  187.          <td><b>操作</b></td>
  188.        </tr>
  189. <?php
  190. $fso=@opendir($CurrentPath);
  191. while ($file=@readdir($fso)) {
  192.    $fullpath    = "$CurrentPath/$file";
  193.    $is_dir        = @is_dir($fullpath);
  194.    if($is_dir=="0"){
  195.    $size=@filesize("$CurrentPath/$file");
  196.    $size=@getSize($size);
  197.    $lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file"));
  198.    echo "<tr>\n";
  199.    echo "<td>● $file</td>\n";
  200.    echo "  <td>$lastsave</td>\n";
  201.    echo "  <td>$size</td>\n";
  202.    echo "  <td><a href=\"?downfile=".urlencode($CurrentPath)."/".urlencode($file)."\">下载</a> | <a href=\"?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."\">删除</a></td>\n";
  203.    echo "</tr>\n";
  204.    }
  205. }
  206. @closedir($fso);
  207. ?>
  208.      </table>
  209.    </td>
  210.   </tr>
  211. </table>
  212. <table width="760" border="0" align="center" cellpadding="3" cellspacing="3">
  213.   <tr>
  214.    <td class="content"><strong>服务器操作系统: <?php echo php_uname();?></strong></td>
  215.   </tr>
  216. </table>
  217. <style>
  218. </body>
  219. </html>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2006 年 1 月 24 日 19:15:36 | 显示全部楼层
引用第1楼qq9992006-01-24 19:12发表的“”:
pm--VBVS吧!呵呵~
谢谢
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:15:47 | 显示全部楼层
2. 很强大的一个:
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:16:11 | 显示全部楼层
支持3楼的
不过想问LZ
是不是存东西到邮箱啊?
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2006 年 1 月 24 日 19:16:27 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
引用第2楼esnak2006-01-24 19:14发表的“”:
1.我自己修改美化的一个
[code]<?php
error_reporting(0);
function upfile($file_var,$tofile,$filepath){
   if(!is_writable($filepath)){
.......
谢谢
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:18:26 | 显示全部楼层
支持支持
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:31:55 | 显示全部楼层
引用第4楼esnak2006-01-24 19:15发表的“”:
2. 很强大的一个:
这个用用户名和密码的,不知用户名密码是什么?

//修改这部分为你自己的管理员身份验证方式
  if(getenv(HTTP_CLIENT_IP))  {$REMOTE_ADDR = getenv(HTTP_CLIENT_IP);}
  elseif(getenv(HTTP_X_FORWARDED_FOR)) {$REMOTE_ADDR = getenv(HTTP_X_FORWARDED_FOR);}
  else {$REMOTE_ADDR = getenv("REMOTE_ADDR");}
  if($REMOTE_ADDR!=""&&$REMOTE_ADDR!="")//允许直接访问的IP
    { if(!isset($PHP_AUTH_USER))
   { Header("WWW-Authenticate:Basic realm=\"$REMOTE_ADDR 管理员登陆\"");
     Header("HTTP/1.0 401 Unauthorized");
     echo "对不起,您没有权限\n";
     exit();}
   else{ if((md5($PHP_AUTH_USER)!="21232f297a57a5a743894a0e4a801fc3") || (md5($PHP_AUTH_PW)!="1a1dc91c907325c69271ddf0c944bc72"))
       { Header("WWW-Authenticate:Basic realm=\"用户名或者密码错误\"");
           Header("HTTP/1.0 401 Unauthorized");
           exit();}
   }
}
//管理员身份验证,下面为管理员看到的内容
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 1 月 24 日 19:33:58 | 显示全部楼层
用户名是admin
密码是pass

也可以自己算md5替换22和23行的md5
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2025 年 2 月 2 日 01:01 , Processed in 0.020685 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表