All pastes #507619 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-24 17:21 UTC
rendered paste body
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

</head>



<body>



<?
function counter() {

static $num = 0;
return ++$num;
}

$subdir = 'tma';

$dir = opendir($subdir);

if (!$dir) {
	die('FAILED to open directory. Are you sure it exists?');
	}
	
while (false!==($file=readdir($dir))) {
	
	if (!is_file($subdir.'/'.$file)) {
	continue;
	}
	
$heading = explode('.',$file);
echo "<h2>$heading[0]</h2>";


$fid = fopen('tma/'.$file,'r');

while (!feof($fid)) {
	

$line = fgets($fid,1024);

$regexa='/(^.+articles.+$)/i';

if(preg_match($regexa,$line))  {
$art = counter();
}
}

echo $art;

fclose($fid);
}

closedir($dir);
	

?>



</body>

</html>