PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Author Message
TheosEleos
Life Cycles Becoming CPU Cycles


Joined: Sep 18, 2003
Posts: 960
Location: Missouri

PostPosted: Sat Jan 24, 2004 8:34 am Reply with quote Back to top

I would like a simple script that will tell me how much space is left on the server.

I have a lot of ftp users and I would like for them to be able to see how much space is left on the server. I really don't want everyone logging in to cpanel.

If I could make it a module I can protect it with Protector System or something.

Can this be done?
View user's profile Send private message Visit poster's website AIM Address ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Jan 24, 2004 9:45 am Reply with quote Back to top

Check this link for all kinds of tools for server management
Only registered users can see links on this board!
Get registered or login to the forums!
.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
TheosEleos
Life Cycles Becoming CPU Cycles


Joined: Sep 18, 2003
Posts: 960
Location: Missouri

PostPosted: Sun Jan 25, 2004 1:36 pm Reply with quote Back to top

I found something but am having a hard time converting it to a module. I get this after I enter a password, doesn't matter if the password is right or wrong.


Quote:
Sorry, you can't access this file directly...


Here is the module I created.
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address ICQ Number
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1396
Location: Puerto Rico

PostPosted: Sun Jan 25, 2004 10:54 pm Reply with quote Back to top

Change diskspace.php to:
Code:
<?
#####################################################################
#  DiskSpace 0,23
#  Released under the terms of the GNU General Public License.
#  Please refer to the README file for more information.
#####################################################################

#####################################################################
# PLEASE EDIT THE FOLLOWING VARIABLES:
#####################################################################

# Please choose a language file:
$languageFile = "./modules/Diskspace/language_files/english.php";

# Your home directory on the server. Check the README file if you
# don't know how to find your home directory.
$user_home = "/home/ph/public_html";

# The available hard disk space for your user on the server --
# measured in megabytes.
$available_space = "1500";

# Choose a password. You will have to enter this password when you
# view DiskSpace in a browser.
$password = "test";

#####################################################################
# THAT'S IT! NO MORE EDITING NECESSARY.
#####################################################################



require($languageFile);

exec("du -s $user_home", $du);   # This will output something like "3383    /home/user"
$brugtplads = split(" ", $du[0]);

$brugtplads = $brugtplads[0] / 1024;
$pladstilbage = $available_space - $brugtplads;

$p = $available_space / 100;
$p_brugtplads = round($brugtplads / $p);
$p_pladstilbage = round($pladstilbage / $p);

$bredde_brugt = $p_brugtplads * 3;   # This is used as the "width" attribute in the "<img>" tag.
$bredde_tilbage = $p_pladstilbage * 3;   # This is used as the "width" attribute in the "<img>" tag.

function afrunding($tal) {
        global $module_name;
   if (ereg("\.", $tal)) {               # Example: $tal = 12.2547821
      $tal = split("\.", $tal);         # $tal[0] = 12 and $tal[1] = 2547821
      $tal[1] = substr($tal[1], 0, 2);      # $tal[1] = 25
      $ciffer1 = substr($tal[1], 0, 1);      # $ciffer1 = 2
      $ciffer2 = substr($tal[1], 1, 2);      # $ciffer2 = 5
      if ($ciffer2 >= 5) $ciffer1 = $ciffer1 + 1;   # $ciffer1 now becomes 3
      $tal = "$tal[0].$ciffer1";         # $tal is now 12.3
   }
   return $tal;
}



echo "<html><head><title>DiskSpace</title>\n";
echo "<style type=text/css><!--\n";
echo "body {background:white; font-family:lucida,helvetica}\n";
echo "--></style>\n";
echo "</head>\n";
include("header.php");

if (!$adgangskode) {
   OpenTable();
   echo "<body onLoad=document.forms[0].adgangskode.focus()>\n";
   echo "<form action=modules.php?name=$module_name&amp;file=diskspace method=post>\n";
   echo "$l1<br>\n";
   echo "<input type=text name=adgangskode size=20>\n";
   echo "<input type=submit value=\"$l9\">\n";
   echo "</form>\n";
   echo "</body></html>";
   CloseTable();
}

if ($adgangskode && $adgangskode != $password) {
   OpenTable();
   echo "<body>\n";
   echo "<h2>$l2</h2>\n";
   echo "</body></html>";
   CloseTable();
}

if ($adgangskode == $password) {
   OpenTable();
   echo "<body>\n";
   echo "<h2>$l3</h2>\n";
   echo "<img src=image.gif height=20 width=$bredde_brugt alt=\"$l4: $p_brugtplads$l7\">";
   echo "<img src=image_gray.gif height=20 width=$bredde_tilbage alt=\"$l5: $p_pladstilbage$l7\"><p>\n";

   echo "<img src=image.gif height=20 width=10 alt=\"$l6\"><img src=image_gray.gif height=20 width=10 alt=\"$l6\">\n";
   echo "$l6: $available_space $l8 (100$l7)<p>\n";
   echo "<img src=image.gif height=20 width=20 alt=\"$l4\">\n";
   echo "$l4: ".afrunding($brugtplads)." $l8 ($p_brugtplads$l7)<p>\n";
   echo "<img src=image_gray.gif height=20 width=20 alt=\"$l5\">\n";
   echo "$l5: ".afrunding($pladstilbage)." $l8 ($p_pladstilbage$l7)\n";

   echo "</body></html>";
   CloseTable();
}
include("footer.php");
?>

and index.php to:
Code:
<?php
        if (!eregi("modules.php", $PHP_SELF)) die ("You can't access this file directly...");

        $module_name = basename(dirname(__FILE__));
        require_once("mainfile.php");
        $pagetitle = "- Available Space";
        global $module_name;

        include("modules/$module_name/diskspace.php");

?>
View user's profile Send private message Visit poster's website
TheosEleos
Life Cycles Becoming CPU Cycles


Joined: Sep 18, 2003
Posts: 960
Location: Missouri

PostPosted: Sun Jan 25, 2004 11:34 pm Reply with quote Back to top

That worked perfect. Can you help me with the images? They didn't work at all.

Thanks for your time, chatserv.
View user's profile Send private message Visit poster's website AIM Address ICQ Number
TheosEleos
Life Cycles Becoming CPU Cycles


Joined: Sep 18, 2003
Posts: 960
Location: Missouri

PostPosted: Sun Jan 25, 2004 11:38 pm Reply with quote Back to top

I figured it out.

Thanks again. Very Happy
View user's profile Send private message Visit poster's website AIM Address ICQ Number
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1396
Location: Puerto Rico

PostPosted: Sun Jan 25, 2004 11:54 pm Reply with quote Back to top

Wink
View user's profile Send private message Visit poster's website
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum