Jump to content

Tables


Bob Norris

Recommended Posts

Hi,

 

A friend wrote this script for me a while back and I need to get the output to appear in tables. The output at the bottom is what I need to show in two side by side tables:

 

echo $dirs[$k].'  Shows the folder name and ----[  '.$v.' ]  is the count

 

foreach ($files as $k => $v) {

echo $dirs[$k].' ----[  '.$v.' ]    <br />';

}

 

 

Right now it just prints on one line and is not centered or aligned. I would like to have the tables contain each information output.

 

Thank you for your help!

 

<html>
<center><head>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number)	{
return (number < 1000) ? number + 1900 : number;
							}

// Join it all together
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;

// Print out the data.
document.write(today);

//  End -->
</script>       
</html>
<meta http-equiv="refresh" content="30" /> 
<br><p><?php 
$delete = $_REQUEST['delete'];

if ($delete) {	
	foreach (glob('*',GLOB_ONLYDIR) as $dir) {
		$file = $dir.'/bot2.log';

		if (is_file($file)) {
			@unlink($file);
		}
	}				
}
?>
<?php
$dirs = array();
$files = array();

$i=0;
foreach (glob('*',GLOB_ONLYDIR) as $dir) {
	$file = $dir.'/bot2.log';

	if (is_file($file)) {
		$dirs[$i] = $dir;
		//$files[$i] = filesize($file);
		$files[$i] = sizeof(file($file))/2;
		++$i;
	}
}

arsort($files);

foreach ($files as $k => $v) {
	echo $dirs[$k].' ----[   '.$v.' ]    <br />';
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.