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>
<?php
function counter() {
global $num;
return ++$num;
}
function heading() {
global $file;
$heading = explode('.', $file);
echo "<h2>$heading[0]</h2>";
}
function match($regex) {
global $fid;
}
function total() {
global $i;
return ++$i;
}
function errors() {
global $i ;
global $line;
global $lines;
$bits = explode(" ",$line);
$lines = array($i+1=>$bits[7].$bits[5]);
}
$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();
$i = 0;
$num = 0;
$fid = fopen('tma/'.$file, 'r');
$regex = '/(^.+articles.+$)/i';
$lines = array();
while (!feof($fid)) {
$line = fgets($fid, 1024);
errors();
total();
if (preg_match($regex, $line)) {
counter();
}
}
print_r($lines);
echo $i-1,'<br />';
echo $num,'<br />';
}
fclose($fid);
closedir($dir);
?>
</body>
</html>