newsupload.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. include("../config/tpclass.php");
  5. AdminSes_audit();
  6. if(!strstr($adminqx,",0,") && !strstr($adminqx,",0201,")){echo "无权限";exit;}
  7. $bh=$_GET[bh];
  8. while1("bh,sj","yjcode_news where bh='".$bh."'");if(!$row1=mysql_fetch_array($res1)){exit;}
  9. $tplj1="upload/news/".dateYMDN($row1[sj])."/".$bh."/";
  10. if($_GET[action]=="update"){ //上传
  11. createDir("../upload/news/".dateYMDN($row1[sj])."/");
  12. createDir("../upload/news/".dateYMDN($row1[sj])."/".$bh."/");
  13. $sj=date("Y-m-d H:i:s");
  14. $nbh=time();
  15. $wjv=$tplj1.$nbh.".jpg";
  16. intotable("yjcode_clear","bh,tp,type1,sj","'".$bh."','".$wjv."','".$_GET[ty]."','".$sj."'");$clearid=mysql_insert_id();
  17. uploadtpnodata(1,$tplj1,$nbh.".jpg","allpic",600,500,120,100);
  18. php_toheader("newsupload.php?bh=".$bh."&tpbh=".$nbh."&clearid=".$clearid);
  19. }elseif($_GET[action]=="del"){ //删除
  20. if(panduan("bh","yjcode_news where bh='".$bh."'")==1){
  21. delFile("../".$tplj1.$_GET[tpbh].".jpg");
  22. delFile("../".$tplj1.$_GET[tpbh]."-1.jpg");
  23. if($_GET[clearid]!=""){deletetable("yjcode_clear where id=".$_GET[clearid]);}
  24. if($_GET[tpid]!=""){deletetable("yjcode_tp where bh='".$bh."' and id=".$_GET[tpid]);}
  25. php_toheader("newsupload.php?bh=".$bh);
  26. }
  27. }
  28. $dis1="none";
  29. $dis3="none";
  30. $tpx="-1";
  31. if($_GET[tpbh]!=""){
  32. $dis1="none";$dis3="";$tpv="../".$tplj1.$_GET[tpbh].$tpx.".jpg";$tpvb="../".$tplj1.$_GET[tpbh].".jpg";
  33. }elseif($_GET[tpbh]==""){$dis1="";$dis3="none";}
  34. ?>
  35. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  36. <html xmlns="http://www.w3.org/1999/xhtml">
  37. <head>
  38. <meta http-equiv="x-ua-compatible" content="ie=7" />
  39. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  40. <meta name="keywords" content="">
  41. <meta name="description" content="">
  42. <title>图片上传</title>
  43. <style type="text/css">
  44. body{margin:0;font-size:12px;color:#333;}
  45. p{margin:2pt 0 0 0;}
  46. *{margin:0 auto;padding:0;}
  47. ul{list-style-type:none;margin:0;padding:0;}
  48. .main{float:left;width:74px;height:91px;}
  49. #upload .inptp{position: relative;overflow: hidden;display:inline-block;*display:inline;padding:39px 0 0 0;height:52px;text-align:center;cursor:pointer;width:74px;float:left;}
  50. #upload .inptp input{position: absolute;border:solid transparent;opacity: 0;filter:alpha(opacity=0); cursor: pointer;float:left;width:101px;height:91px;margin:-39px 0 0 -96px;}
  51. #delbtn{float:left;background-color:#404141;width:74px;height:16px;text-align:center;padding:4px 0 0 0;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;
  52. opacity: 0.7;position:absolute;margin:71px 0 0 0;}
  53. #delbtn img{cursor:pointer;}
  54. </style>
  55. <script language="javascript">
  56. function filecha(){
  57. document.getElementById("upload").style.display="none";
  58. document.getElementById("uping").style.display="";
  59. tpf.submit();
  60. }
  61. function tover(){
  62. <? if($_GET[tpbh]!=""){?>document.getElementById("delbtn").style.display="";<? }?>
  63. }
  64. function tout(){
  65. document.getElementById("delbtn").style.display="none";
  66. }
  67. function del(){
  68. document.getElementById("tph").style.display="none";
  69. document.getElementById("uping").style.display="";
  70. location.href="newsupload.php?tpbh=<?=$_GET[tpbh]?>&action=del&bh=<?=$bh?>&tpid=<?=$_GET[tpid]?>&clearid=<?=$_GET[clearid]?>&ty=<?=urlencode($_GET[ty])?>";
  71. }
  72. </script>
  73. </head>
  74. <body>
  75. <div class="main">
  76. <!--删除按钮-->
  77. <div id="delbtn" style="display:none;">
  78. <img src="img/delbtn.png" onclick="del()" width="11" height="11" />
  79. </div>
  80. <!--删除按钮-->
  81. <!--等待上传开始-->
  82. <form method="post" name="tpf" enctype="multipart/form-data" action="newsupload.php?tpbh=<?=$_GET[tpbh]?>&action=update&bh=<?=$bh?>&ty=<?=urlencode($_GET[ty])?>">
  83. <div id="upload" style="display:<?=$dis1?>;">
  84. <span class="inptp"><span>效果图上传</span>
  85. <input type="file" onchange="filecha()" name="inp1" id="inp1" size="25" accept=".jpg,.gif,.jpeg,.png"></span>
  86. </div>
  87. <input type="hidden" value="upload" name="jvs" />
  88. </form>
  89. <!--等待上传结束-->
  90. <!--正在上传-->
  91. <div id="uping" style="display:none;">
  92. <img src="img/grey.gif" width="74" height="91" />
  93. </div>
  94. <!--正在上传-->
  95. <!--有图-->
  96. <div id="tph" style="display:<?=$dis3?>;">
  97. <a href="<?=$tpvb?>" target="_blank"><img border="0" src="<?=$tpv?>?rid=<?=rnd_num(100)?>" id="tpimg" width="74" height="91" /></a>
  98. </div>
  99. <!--有图-->
  100. </div>
  101. </body>
  102. </html>