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
https://forums.phpfreaks.com/topic/131095-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.