文件夹权限和提交按钮

发布于 2024-09-01 00:13:50 字数 1081 浏览 3 评论 0原文

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

<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>

如何使所有文件和文件夹的权限为777有效时会出现提交按钮

<input type='submit' name='submit' value='Submit' />

如果仍然有不正确的权限,请不要显示“提交”按钮,

请告诉我。

I want to create a simple installation script. Below are simple code.

<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>

How to make if all file and folder is valid permission to 777 will appear Submit button.

<input type='submit' name='submit' value='Submit' />

If there still have incorrect permission do not show the Submit button

Let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兲鉂ぱ嘚淚 2024-09-08 00:13:50

呃,这会有点脏,但是:

<?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">';
   ?>

Uh, this is going to be a bit dirty, but:

<?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">';
   ?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文