im working on an administration panel for my website and im having a bit of trouble. i need to put the output of shell_exec('ls -a') into an array. but when i used the explode function it doesnt work because there is no seperater charactor in the string from shell_exec. this is my code.
<html>
<head>
<link href="include/styles.css" rel="stylesheet" type="text/css">
</head>
<body class="text">
<?php
$rootdir = '/usr/local/apache/htdocs';
$apacheVersion = apache_get_version();
$diskFreeKB = disk_free_space($rootdir)/1024;
$diskTotalKB = disk_total_space($rootdir)/1024;
$command = shell_exec('ls -a');
$content = explode(' ', $command);
$contentCount = count(content);
$loop = 0;
echo "<center><font size=\"3\"><b>Administration Panel</b></font></center>";
echo "<b>Server Version:</b> $apacheVersion<br>";
echo "<b>Total Disk Space:</b> $diskTotalKB KB<br>";
echo "<b>Free Disk Space:</b> $diskFreeKB KB<br>";
echo "$contentCount Files:<br>";
while ($loop <= $contentCount){
echo "$content[$loop] <br>";
$loop++;
};
?>
</body>
</html>
the string from $command displays on the pages as:
. .. .htaccess .htaccess~ include index.php index.php~ mysql
however when i view the html source of this page it is written like this:
.
..
.htaccess
.htaccess~
include
index.php
index.php~
mysql
there is no character between the files what would the separater character be?