私はワードプレスのブログに取り組んでいます。以前の開発者は、「Exec-PHP」を使用して、ページ内で PHP スクリプトを実行していました。
http://url-of-the-page/
「/homez.406/xxx/www/wp-content/xxx/xxx/」に含まれるファイルの一覧に次のように表示されます。
ファイルを日付順に並べたいのですが、やり方がわかりません。誰かがすでにこれを使用していますか?
<!--?php showContent('/homez.406/xxx/www/wp-content/xxx/xxx/','http://url-of-the-page/',false,false); ?-->
これは、functions.php で見つけたものです。
function showContent($path,$webpath,$adminclear,$adminup){
if ($handle = opendir($path))
{
if ($adminclear==true)
{
global $user_ID; if( $user_ID ) :
if( current_user_can('level_10') ) :
$auth=true;
else :
$auth=false;
endif;
endif;
}
if ($adminup==true)
{
global $user_ID; if( $user_ID ) :
if( current_user_can('level_10') ) :
$authup=true;
else :
$authup=false;
endif;
endif;
}
else{$auth=true;$authup=true;}
if ((isset($_POST['dlfile']))&&($auth==true))
{
$removefile=$_POST['dlfile'];
unlink ($removefile);
}
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$fName = $file;
$goodpath=$webpath.$fName;
$file = $path.$file;
$abpath=$path.$fName;
if(is_file($file)) {
echo "<p><a href='http://www.otrmd.com/wp-content/themes/FactoryWP/dl.php?p=".$goodpath."&f=".$fName."'>".$fName."</a><br/> Uploaded on ".date ('d-m-Y H:i:s', filemtime($file))."<br/>Size: ".filesize($file)." bytes</p>";
if($auth==true)
{
echo "<form method='post' action=".$_SERVER['REQUEST_URI'].">
<input type='hidden' name='dlfile' value='".$abpath."'>
<input type='submit' value='Clear File'>
</form><br/>";
}
} elseif (is_dir($file)) {
print "<p><a href='".$_SERVER['PHP_SELF']."?path=$file'>$fName</a></p><br/><br/>";
}
}
}
closedir($handle);
}
if ($authup==true)
{
echo ("[uploadify folder='".$path."' multi=true]");
}
}