Webpad 3.0 Personal > Admin / Home Dir Test.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Webpad 3.0 Personal

Download:
webpad-3.0-personal.zip

Category:
Content Management

Archive Content:

Webpad 3.0 Personal

Webpad 3.0 Personal > Admin

Webpad 3.0 Personal > Css

Webpad 3.0 Personal > Dialogs

Webpad 3.0 Personal > Docs

Webpad 3.0 Personal

Webpad 3.0 Personal > Images

Webpad 3.0 Personal

Webpad 3.0 Personal > Js

Webpad 3.0 Personal

Webpad 3.0 Personal > Locations

Webpad 3.0 Personal

Webpad 3.0 Personal > Plugins > Blogging

Webpad 3.0 Personal > Plugins > Blogger

Webpad 3.0 Personal > Plugins > Blosxom

Webpad 3.0 Personal > Plugins > Livejournal

Webpad 3.0 Personal > Plugins > Movabletype

Webpad 3.0 Personal > Plugins > Typepad

Webpad 3.0 Personal > Plugins > Wordpress

Webpad 3.0 Personal

Webpad 3.0 Personal > Templates

Webpad 3.0 Personal

Home Dir Test.php:


<?php
if (strlen($_GET['hd'])) {
    
$home urldecode($_GET['hd']);
    if (
substr($home,  -1) == '/') {
        if (
is_dir($home)) {
            if (
is_readable($home)) {
                if (
is_writable($home)) {
                    
// All good
                    
$icon 'tick.gif';
                    
$msg 'Home directory appears valid.';
                }
                else {
                    
// Can't write to directory
                    
$icon 'delete-w.gif';
                    
$msg 'This directory is not writable,  so you will not be able to save files to it.';
                }
            }
            else {
                
// Can't read directory contents
                
$icon 'delete-w.gif';
                
$msg 'Cannot read the contents of this directory. Adjust the permissions on your server to allow read and write access.';
            }
        }
        else {
            
// Directory doesn't exist
            
$icon 'delete-w.gif';
            
$msg 'That directory doesn\'t appear to exist,  or you have entered it incorrectly.';
        }
    }
    else {
        
// Doesn't end in a slash
        
$icon 'delete-w.gif';
        
$msg 'The home directory should end in a forward-slash.';
    }
    
    echo 
"<script language=\"JavaScript\" type=\"text/javascript\">\n";
    echo 
"<!--\n";
    echo 
"parent.document.getElementById('home_dir_action').innerHTML = '<img src=\"../images/" $icon "\" alt=\"" addslashes($msg) . "\" title=\"" addslashes($msg) . "\" border=\"0\" align=\"absmiddle\" width=\"22\" height=\"22\" />';\n";
    echo 
"// -->\n";
    echo 
"</script>\n";
}
?>


Other Content Management Scripts:

WebMaster Resources Home

©RingsWorld.com