Not sure how to fix it...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Damon.Vogel
Forum Newbie
Posts: 1
Joined: Fri Feb 06, 2009 3:29 pm

Not sure how to fix it...

Post by Damon.Vogel »

I am the administrator for the Macintosh Network at a small community college. I am trying to have this web page allow you to type in your username, and return the size of the data in your home folder. I have managed to do most of it, except for a single thing. And I think that it's a formatting thing.

Code: Select all

<?php
 
/* Set the full path to start scanning from. If left blank, it will run from the current directory */
 
$dir = "/Volumes/ACC-E-STUDENTS/"; /*All student folders are in this directory*/
$name = $_POST["name"]; /*This line gets the user name inputted on the html page. Ex. miliac45*/
$all = $dir . $name; /*This line joins the two previous lines together. Ex. /Volumes/ACC-E-STUDENTS/miliac45*/
 
/* Run du to get directory sizes */
$tmp2 = exec("du -mh $all",$arr_return,$return); /*This line doesn't return any output. I think that it is due to my concatenation of $dir and $name into $all. If I change $dir to the whole directory, it works o.k. */
 
 
?>
<html>
<head>
<title>Folder Sizes</title>
<style type="text/css"></style>
</head>
 
<body>
DIR :<?php echo $dir; ?><br>/* Echos dir perfectly*/
Name :<?php echo $name; ?><br>/* Echos name perfectly*/
All :<?php echo $all; ?><br>/* Echos all perfectly.*/
 
Calc:<?php echo $tmp2; ?><br> /*Nothing*/
 
 
 
</body>
</html>
 

Please Help!!!!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Not sure how to fix it...

Post by requinix »

Tried printing what's in $arr_return yet? Remember that it's an array.
Post Reply