Russia Posted August 9, 2009 Share Posted August 9, 2009 I currently have this: PHP/b] <?php function check_perms($path,$perm) { clearstatcache(); $configmod = substr(sprintf('%o', fileperms($path)), -4); $trcss = (($configmod != $perm) ? "background-color:#fd7a7a;" : "background-color:#91f587;"); echo "<tr style=".$trcss.">"; echo "<td style=\"border:0px;\">". $path ."</td>"; echo "<td style=\"border:0px;\">$perm</td>"; echo "<td style=\"border:0px;\">$configmod</td>"; echo "</tr>"; } ?> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"text-align:center;\"> <tr> <th style="border:0px;"><b>File Name</b></th> <th style="border:0px;"><b>Needed Chmod</b></th> <th style="border:0px;"><b>Current Chmod</b></th> </tr> <?php check_perms("cache","0777"); check_perms("include/keys","0777"); check_perms("backup","0777"); check_perms("uploads","0777"); check_perms("include/template","0777"); check_perms("include/user","0777"); check_perms("img","0777"); check_perms("img/avatars","0777"); ?> </table> Basicly I need that when all file permissions are correct you are allowed to go to the next page of the installation, if not there can be a refresh button, so that when you change permissions, you can refresh the page to see if the Continue Installation button is showing. Thank You. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/ Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 No one? I would really like some support on this please. :facewall: Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894149 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Still needing help with this please. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894155 Share on other sites More sharing options...
wildteen88 Posted August 9, 2009 Share Posted August 9, 2009 You haven't posted what's wrong with your script. Can you explain what your code is supposed to do and what it is doing now. Please dont keep bumping your post wait at least a couple of hours. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894166 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 I have wrote it myself. But the page is blank. It is supposed to show a button at the bottom. <?php function check_perms($path,$perm) { clearstatcache(); $configmod = substr(sprintf('%o', fileperms($path)), -4); $trcss = (($configmod != $perm) ? "background-color:#fd7a7a;" : "background-color:#91f587;"); echo "<tr style=".$trcss.">"; echo "<td style=\"border:0px;\">". $path ."</td>"; echo "<td style=\"border:0px;\">$perm</td>"; echo "<td style=\"border:0px;\">$configmod</td>"; echo "</tr>"; If($configmod =! $perm){ If($correctperms){ return False; } } } ?> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"text-align:center;\"> <tr> <th style="border:0px;"><b>File Name</b></th> <th style="border:0px;"><b>Needed Chmod</b></th> <th style="border:0px;"><b>Current Chmod</b></th> </tr> <?php global $correctperms = True; check_perms("../inc/config.php","0777"); check_perms("install2.php","0777"); If($correctperms){ //Echo Continue Button Code. echo'<input type="button" onclick"window.location=''test.php''" value="Continue">'; } else { //Echo Refresh Button Code echo'<input type="button" onclick"window.location.reload(true)" value="Refresh">'; } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894181 Share on other sites More sharing options...
wildteen88 Posted August 9, 2009 Share Posted August 9, 2009 You have an HTML issue. You cannot have anything except <tr><td></td></tr> between </tr> and </table>. This line global $correctperms = True; Should be within your function. function check_perms($path,$perm) { global $correctperms = True; ... Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894183 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Can you please post the corrected version of the script? I am not good at php. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894222 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 So? Can you post the correct version? Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894244 Share on other sites More sharing options...
wildteen88 Posted August 9, 2009 Share Posted August 9, 2009 Why dont you try yourself first. You only have to to move one line of code, as I have suggested/shown you. You only need to wrap <tr><td> and </td></tr> around your If($correctperms) statement Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894246 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Like this? <?php function check_perms($path,$perm) { clearstatcache(); $configmod = substr(sprintf('%o', fileperms($path)), -4); $trcss = (($configmod != $perm) ? "background-color:#fd7a7a;" : "background-color:#91f587;"); echo "<tr style=".$trcss.">"; echo "<td style=\"border:0px;\">". $path ."</td>"; echo "<td style=\"border:0px;\">$perm</td>"; echo "<td style=\"border:0px;\">$configmod</td>"; echo "</tr>"; If($configmod =! $perm){ If($correctperms){ return False; } } } ?> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" style=\"text-align:center;\"> <tr> <th style="border:0px;"><b>File Name</b></th> <th style="border:0px;"><b>Needed Chmod</b></th> <th style="border:0px;"><b>Current Chmod</b></th> </tr> <?php function check_perms($path,$perm) { global $correctperms = True; check_perms("../inc/config.php","0777"); check_perms("install2.php","0777"); <tr><td> If($correctperms){ //Echo Continue Button Code. echo'<input type="button" onclick"window.location=''test.php''" value="Continue">'; } else { //Echo Refresh Button Code echo'<input type="button" onclick"window.location.reload(true)" value="Refresh">'; } </td></tr> ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894248 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Sorry I have no idea what to do... Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894261 Share on other sites More sharing options...
wildteen88 Posted August 9, 2009 Share Posted August 9, 2009 No no. Not like that. The first four lines of your code should read <?php function check_perms($path,$perm) { global $correctperms; You should remove the folowing line global $correctperms = True; Hope that clears up what I meant earlier. However after looking at your code further this section: If($configmod =! $perm){ If($correctperms){ return False; } } needs to be changed to If($configmod != $perm){ $correctperms = false; } else { $correctperms = true; } } Also <tr><td> need to be echo "<tr><td>"; and </td></tr> need to be echo "</td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894263 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Can you please post the fully corrected script? I am having lots of trouble with this. Thank You. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894268 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Wildteen88 can you please post the full code? Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894280 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 Are you there wildteen? Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894367 Share on other sites More sharing options...
Cory94bailly Posted August 9, 2009 Share Posted August 9, 2009 You posted 20 minutes apart.. Phpfreaks is a voluntary help service, please wait your turn. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894397 Share on other sites More sharing options...
Russia Posted August 9, 2009 Author Share Posted August 9, 2009 I think I got it: <?php function check_perms($path,$perm) { clearstatcache(); $configmod = substr(sprintf('%o', fileperms($path)), -4); $trcss = (($configmod != $perm) ? "background-color:#fd7a7a;" : "background-color:#91f587;"); echo "<tr style=".$trcss.">"; echo "<td style=\"border:0px;\">". $path ."</td>"; echo "<td style=\"border:0px;\">$perm</td>"; echo "<td style=\"border:0px;\">$configmod</td>"; echo "</tr>"; } if ($chmods = "0777") { test continue } else { test refresh } ?> <table id="notice" align="center" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> <tr> <th align="left" style="border:0px;"><b>File/Folder Name</b></th> <th align="left" style="border:0px;"><b>Needed Chmod</b></th> <th align="left" style="border:0px;"><b>Current Chmod</b></th> </tr> <?php check_perms("install2.php","0777"); check_perms("../inc/config.php","0777"); ?> What am I doing wrong? It shows a blank page... Hey Cory, whats ur msn? I would like to add you to my buddy list. Quote Link to comment https://forums.phpfreaks.com/topic/169473-file-permissions-button/#findComment-894399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.