2016-02-19 22:23:37 -08:00
|
|
|
<?php
|
|
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
// Original code: The Wizard of DATz
|
|
|
|
|
|
|
|
|
|
print "<pre>";
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-03-01 17:19:18 -08:00
|
|
|
$mainPages = array(
|
2016-02-19 22:23:37 -08:00
|
|
|
"http://www.tzxvault.org/index.htm",
|
|
|
|
|
"http://www.tzxvault.org/Amstrad/index.htm",
|
|
|
|
|
"http://www.tzxvault.org/C16/index.htm",
|
|
|
|
|
"http://www.tzxvault.org/C64/index.htm",
|
|
|
|
|
"http://www.tzxvault.org/Vic20/index.htm",
|
|
|
|
|
);
|
|
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$pages = array();
|
2016-02-19 22:23:37 -08:00
|
|
|
|
|
|
|
|
foreach ($mainPages as $page)
|
|
|
|
|
{
|
|
|
|
|
print "load ".$page."\n";
|
2016-03-01 17:19:18 -08:00
|
|
|
$content = get_data($page);
|
2016-02-26 12:48:32 -08:00
|
|
|
$content = explode('href="', $content);
|
|
|
|
|
array_splice($content, 0, 1);
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
foreach ($content as $row)
|
|
|
|
|
{
|
|
|
|
|
$row = explode('"', $row);
|
|
|
|
|
$row = $row[0];
|
2016-02-19 22:23:37 -08:00
|
|
|
print "found ".$row."\n";
|
2016-02-26 12:48:32 -08:00
|
|
|
$pages[$row] = $row;
|
2016-02-19 22:23:37 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($pages as $page)
|
|
|
|
|
{
|
|
|
|
|
print "load ".$page."\n";
|
|
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$dirs = array();
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$new = 0;
|
|
|
|
|
$old = 0;
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-03-01 17:19:18 -08:00
|
|
|
$content = get_data($page);
|
2016-02-26 12:48:32 -08:00
|
|
|
$content = str_replace(' ', ' ', $content);
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$content2 = explode('<font color="#FF0000">', $content);
|
|
|
|
|
$content2[0] = null;
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$content = explode('<a href="http://www.tzxvault.org/', $content);
|
|
|
|
|
$content[0] = null;
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
foreach ($content as $row)
|
|
|
|
|
{
|
|
|
|
|
if ($row)
|
|
|
|
|
{
|
|
|
|
|
$url = explode('"', $row);
|
|
|
|
|
$url = $url[0];
|
|
|
|
|
$ext = explode('.', $url);
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
if (count($ext) > 1)
|
2016-02-19 22:23:37 -08:00
|
|
|
{
|
2016-02-26 12:48:32 -08:00
|
|
|
$name = explode('</a>', $row);
|
|
|
|
|
$name = strip_tags($name[0]);
|
|
|
|
|
$name = explode('>', $name);
|
|
|
|
|
$name = trim($name[1]);
|
|
|
|
|
|
|
|
|
|
$addinf = explode('<td>', $row);
|
|
|
|
|
$publ = explode('</td>', $addinf[1]);
|
|
|
|
|
$publ = trim(strip_tags($publ[0]));
|
|
|
|
|
if ($publ)
|
|
|
|
|
{
|
|
|
|
|
$name = $name." (".$publ.")";
|
|
|
|
|
}
|
|
|
|
|
$year = explode('</td>', $addinf[2]);
|
|
|
|
|
$year = trim(strip_tags($year[0]));
|
|
|
|
|
if ($year)
|
|
|
|
|
{
|
|
|
|
|
$name = $name." (".$year.")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$url_split = explode('/', $url);
|
|
|
|
|
|
|
|
|
|
if ($name)
|
|
|
|
|
{
|
|
|
|
|
$name = $name.".".$ext[count($ext) - 1];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$name = $url_split[count($url_split) - 1];
|
2016-02-19 22:23:37 -08:00
|
|
|
}
|
|
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$url_split[count($url_split) - 1] = null;
|
|
|
|
|
$url_split = implode('/', $url_split);
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
$dirs[$url_split] = $url_split;
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
if (!$r_query[$url])
|
|
|
|
|
{
|
|
|
|
|
$found[] = array($url, $name);
|
2016-02-19 22:23:37 -08:00
|
|
|
$new++;
|
2016-02-26 12:48:32 -08:00
|
|
|
$r_query[$url] = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-02-19 22:23:37 -08:00
|
|
|
$old++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
foreach ($content2 as $row)
|
|
|
|
|
{
|
|
|
|
|
if ($row)
|
|
|
|
|
{
|
|
|
|
|
$name = explode('</font>', $row);
|
|
|
|
|
$name = $name[0];
|
|
|
|
|
$file = str_replace(' ', '', $name).".zip";
|
|
|
|
|
|
|
|
|
|
$addinf = explode('<td>', $row);
|
|
|
|
|
$publ = explode('</td>', $addinf[1]);
|
|
|
|
|
$publ = trim(strip_tags($publ[0]));
|
|
|
|
|
if ($publ)
|
|
|
|
|
{
|
|
|
|
|
$name = $name." (".$publ.")";
|
|
|
|
|
}
|
|
|
|
|
$year = explode('</td>', $addinf[2]);
|
|
|
|
|
$year = trim(strip_tags($year[0]));
|
|
|
|
|
if ($year)
|
|
|
|
|
{
|
|
|
|
|
$name = $name." (".$year.")";
|
|
|
|
|
}
|
2016-02-19 22:23:37 -08:00
|
|
|
|
|
|
|
|
foreach($dirs as $dir)
|
|
|
|
|
{
|
2016-02-26 12:48:32 -08:00
|
|
|
$url = $dir.$file;
|
|
|
|
|
if (!$r_query[$url])
|
|
|
|
|
{
|
|
|
|
|
$found[] = array($url, $name.".zip");
|
2016-02-19 22:23:37 -08:00
|
|
|
$new++;
|
2016-02-26 12:48:32 -08:00
|
|
|
$r_query[$url] = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-02-19 22:23:37 -08:00
|
|
|
$old++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "found new ".$new.", old ".$old."\n";
|
|
|
|
|
}
|
2016-02-26 12:48:32 -08:00
|
|
|
sort($found);
|
2016-02-19 22:23:37 -08:00
|
|
|
|
2016-02-26 12:48:32 -08:00
|
|
|
print "<table><tr><td><pre>";
|
|
|
|
|
|
|
|
|
|
foreach ($found as $row)
|
|
|
|
|
{
|
|
|
|
|
print $row[0]."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</td><td><pre>";
|
|
|
|
|
|
|
|
|
|
foreach ($found as $row)
|
|
|
|
|
{
|
|
|
|
|
print "<a href=\"http://www.tzxvault.org/".$row[0]."\" target=_blank>".$row[1]."</a>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</td></tr></table>";
|
2016-02-19 22:23:37 -08:00
|
|
|
?>
|