Php 文件夹权限和提交按钮

Php 文件夹权限和提交按钮,php,permissions,file-permissions,Php,Permissions,File Permissions,我想创建一个简单的安装脚本。下面是简单的代码 <ul> <?php function check_perms($path,$perm) { clearstatcache(); $configmod = substr(sprintf('%o', fileperms($path)), -4); $css = (($configmod != $perm) ? " class='error'" : " class='none'"); echo "&l

我想创建一个简单的安装脚本。下面是简单的代码

<ul>
<?php 
function check_perms($path,$perm)
{
    clearstatcache();
    $configmod = substr(sprintf('%o', fileperms($path)), -4); 
    $css = (($configmod != $perm) ? " class='error'" : " class='none'");
    echo "<li".$css.">\n"; 
    echo '<span style="float:left; padding-right:20px;">'.$path.'</span>'; 
    echo '<span style="float:right; width:100px; text-align:right;">  <strong>'.$perm.'</strong></span>'; 
    echo '<span style="float:right; padding-right:100px;"><strong>'.$configmod.'</strong></span>'; 
    echo '<div class="clear"></div>'; 
    echo "</li>";

}  
    check_perms("config.php","0777");
    check_perms("themes","0777");
    check_perms("themes/images","0777");
    check_perms("useruploads","0777");
?>
</ul>
如果仍有不正确的权限,请不要显示“提交”按钮


让我知道。

嗯,这会有点脏,但是:

<?php

$error=0; 
function check_perms($path,$perm)
{
    global $error;
    clearstatcache();
    $configmod = substr(sprintf('%o', fileperms($path)), -4); 
    $css = (($configmod != $perm) ? " class='error'" : " class='none'");
    if($configmod != $perm) $error++;
    echo "<li".$css.">\n"; 
    echo '<span style="float:left; padding-right:20px;">'.$path.'</span>'; 
    echo '<span style="float:right; width:100px; text-align:right;">  <strong>'.$perm.'</strong></span>'; 
    echo '<span style="float:right; padding-right:100px;"><strong>'.$configmod.'</strong></span>'; 
    echo '<div class="clear"></div>'; 
    echo "</li>";

}  
    check_perms("config.php","0777");
    check_perms("themes","0777");
    check_perms("themes/images","0777");
    check_perms("useruploads","0777");

   if($error > 0) echo 'Dude, fix the permissions!';
   else echo '<input type="submit">';
   ?>

<?php

$error=0; 
function check_perms($path,$perm)
{
    global $error;
    clearstatcache();
    $configmod = substr(sprintf('%o', fileperms($path)), -4); 
    $css = (($configmod != $perm) ? " class='error'" : " class='none'");
    if($configmod != $perm) $error++;
    echo "<li".$css.">\n"; 
    echo '<span style="float:left; padding-right:20px;">'.$path.'</span>'; 
    echo '<span style="float:right; width:100px; text-align:right;">  <strong>'.$perm.'</strong></span>'; 
    echo '<span style="float:right; padding-right:100px;"><strong>'.$configmod.'</strong></span>'; 
    echo '<div class="clear"></div>'; 
    echo "</li>";

}  
    check_perms("config.php","0777");
    check_perms("themes","0777");
    check_perms("themes/images","0777");
    check_perms("useruploads","0777");

   if($error > 0) echo 'Dude, fix the permissions!';
   else echo '<input type="submit">';
   ?>