From b84debcdf769d3c52f4e9bc48eb0ef40980d13cc Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 24 Feb 2016 20:40:33 -0800 Subject: [PATCH] Mostly C64 site checkers. Some had weird issues that needed to be fixed --- wizzardRedux/admin/onlinecheck.php | 25 ++--- wizzardRedux/sites/6502dude.php | 12 +-- wizzardRedux/sites/C64Heaven.php | 12 ++- wizzardRedux/sites/C64ch.php | 123 +++++++++++++----------- wizzardRedux/sites/C64intros.php | 99 ++++++++++--------- wizzardRedux/sites/C64intros.txt | 78 ++++++++++++++- wizzardRedux/sites/c16de.php | 83 ++++++++-------- wizzardRedux/sites/c64com.php | 146 +++++++++++++++++------------ wizzardRedux/sites/c64com.txt | 2 + wizzardRedux/sites/c64gamescom.php | 5 + wizzardRedux/sites/c64gamesde.php | 104 ++++++++++---------- 11 files changed, 411 insertions(+), 278 deletions(-) diff --git a/wizzardRedux/admin/onlinecheck.php b/wizzardRedux/admin/onlinecheck.php index b38f6e2..558b07c 100644 --- a/wizzardRedux/admin/onlinecheck.php +++ b/wizzardRedux/admin/onlinecheck.php @@ -33,6 +33,12 @@ $checked = array ( "BananaRepublic", "bjars", "BrutalDeluxeSoftware", + "c16de", + "C64ch", + "c64com", + "c64gamescom", // Empty checker page? + "c64gamesde", + ); if (!isset($_GET["source"])) @@ -44,7 +50,7 @@ if (!isset($_GET["source"])) if (preg_match("/^.*\.php$/", $file)) { $file = substr($file, 0, sizeof($file) - 5); - echo "".htmlspecialchars($file)."
"; + echo "".htmlspecialchars($file)."
"; } } @@ -62,16 +68,15 @@ elseif (!file_exists("../sites/".$_GET["source"].".php")) $source = $_GET["source"]; -// Do all onlinecheck pages use this? -if (array_key_exists($source, $checked)) +if (in_array($source, $checked)) { echo "

Loading pages and links...

"; - $r_query = file("sites/".$source.".txt"); + $r_query = file("../sites/".$source.".txt"); $r_query = array_flip($r_query); // There is the case that all keys will contain a whitespace character at the end - $s_query = Array(); + $s_query = array(); while (list($k, $v) = each($r_query)) { $s_query[trim($k)] = $r_query[$k]; @@ -79,16 +84,12 @@ if (array_key_exists($source, $checked)) $r_query = $s_query; unset($s_query); - $found = Array(); + $found = array(); $base_dl_url = ""; -} -// If we get to this point, we assume that it's good -// Original code: The Wizard of DATz -include_once("../sites/".$source.".php"); + // Original code: The Wizard of DATz + include_once("../sites/".$source.".php"); -if (array_key_exists($source, $checked)) -{ echo "

New files:

"; foreach ($found as $row) diff --git a/wizzardRedux/sites/6502dude.php b/wizzardRedux/sites/6502dude.php index 8681b21..1b42d8e 100644 --- a/wizzardRedux/sites/6502dude.php +++ b/wizzardRedux/sites/6502dude.php @@ -4,7 +4,7 @@ $base_dl_url = "http://armas.cbm8bit.com/tapescans/victaps/"; -$pages = Array( +$pages = array( 'http://armas.cbm8bit.com/0to9taps.html', 'http://armas.cbm8bit.com/ataps.html', 'http://armas.cbm8bit.com/btaps.html', @@ -47,7 +47,7 @@ foreach ($pages as $newfile) foreach ($query as $row) { - if($row != "") + if ($row != "") { $row = explode('"; +$page="http://www.c64heaven.com/"; - $page="http://www.c64heaven.com/"; +print "load ".$page."\n"; - print "load ".$page."\n"; +$content = implode('', file($page)); - $content=implode ('', file ($page)); - - print str_replace(Array('style'),null,$content); +print str_replace(array('style'), null, $content); ?> \ No newline at end of file diff --git a/wizzardRedux/sites/C64ch.php b/wizzardRedux/sites/C64ch.php index ee016be..ce99f31 100644 --- a/wizzardRedux/sites/C64ch.php +++ b/wizzardRedux/sites/C64ch.php @@ -1,66 +1,77 @@ Search for new uploads\n\n"; + +for ($x = $start; $x < $start + 50; $x++) +{ + $query = trim(implode('', file("http://c64.ch/demos/realdetail.php?id=".$x))); + + $OK = explode('C64.CH - The C64 Demo Portal - News', $query); + + $info = array(); + + $gametitle = explode('', $query); + $gameauthor = explode('', $gametitle[1]); + $gametitle = explode(' by ', $gameauthor[0]); + $gameauthor = explode('', $gameauthor[1]); + $gameauthor = trim($gameauthor[0]); + + $year = explode('/demos/list.php?year=', $query); + $year = explode('', $year[1]); + $year = explode('>', $year[0]); + + if ($year) { - $start=$_GET["start"]; - $fp = fopen($_GET["source"]."/ids.txt", "w"); - fwrite($fp, $start); - fclose($fp); + $info[] = $year; + } + + $party = explode('/demos/list.php?source=party&partyid=', $query); + $party = explode('', $party[1]); + $party = explode('>', $party[0]); + $party = trim(str_replace(array(' (', ')'), array(', ', ''), $party[1])); + + if ($party) + { + $info[] = $party; + } + + $gametitle = $gameauthor." (".implode(") (", $info).").zip"; + + if ($OK[1]) + { + print $x."\tnot found\n"; } else { - $start=implode ('', file ($_GET["source"]."/ids.txt")); + print $x."\t".$gametitle."\n"; + $last = $x; } +} - print "
Search for new uploads\n\n";
+if ($last)
+{
+	$start = $last + 1;
+}
 
-	for ($x=$start;$x<$start+50;$x++)
-	{
-		$query=trim(implode ('', file ("http://c64.ch/demos/realdetail.php?id=".$x)));
-
-		$OK=explode ('C64.CH - The C64 Demo Portal - News', $query);
-
-		$info=Array();
-
-		$gametitle=explode ('', $query);
-		$gameauthor=explode ('', $gametitle[1]);
-		$gametitle=explode (' by ', $gameauthor[0]);
-		$gameauthor=explode ('', $gameauthor[1]);
-		$gameauthor=trim($gameauthor[0]);
-
-		$year=explode ('/demos/list.php?year=', $query);
-		$year=explode ('', $year[1]);
-		$year=explode ('>', $year[0]);
-		$year=trim($year[1]);
-
-		if($year)$info[]=$year;
-
-		$party=explode ('/demos/list.php?source=party&partyid=', $query);
-		$party=explode ('', $party[1]);
-		$party=explode ('>', $party[0]);
-		$party=trim(str_replace(array(' (',')'),array(', ',''),$party[1]));
-
-		if($party)$info[]=$party;
-
-		$gametitle=$gameauthor." (".implode(") (",$info).").zip";
-
-		if($OK[1])
-		{
-			print $x."\tnot found\n";
-		}
-		else
-		{
-			print $x."\t".$gametitle."\n";
-			$last=$x;
-		}
-	}
-
-	if($last) $start=$last+1;
-
-	print "\nnext startnr\t".$start."";
+print "\nnext startnr\t".$start."";
 
 ?>
\ No newline at end of file
diff --git a/wizzardRedux/sites/C64intros.php b/wizzardRedux/sites/C64intros.php
index a2444ab..a103aa1 100644
--- a/wizzardRedux/sites/C64intros.php
+++ b/wizzardRedux/sites/C64intros.php
@@ -1,71 +1,68 @@
 ";
+// Original code: The Wizard of DATz
 
-	print "Last fixes\n\n";
+print "
";
 
-	$query=implode ('', file ("http://intros.c64.org/frame.php"));
- 	$query=explode ('', $query);
- 	$query=explode ('FIXED', $query);
+$query = explode('',$row);
-			$gametitle=explode('<',$gametitle[1]);
-			$gametitle=explode (' ', $gametitle[0]);
-			$gametitle[count($gametitle)-1]="(".$gametitle[count($gametitle)-1].")";
-			$gametitle=implode (' ', $gametitle);
+		$id = explode('"', $row);
+		$gametitle = explode('>', $row);
+		$gametitle = explode('<', $gametitle[1]);
+		$gametitle = explode(' ', $gametitle[0]);
+		$gametitle[count($gametitle) - 1] = "(".$gametitle[count($gametitle) - 1].")";
+		$gametitle = implode(' ', $gametitle);
 
-			if (!$r_query[$id[0]]) print $id[0]."\t".$gametitle.".prg\n";
+		if (!$r_query[$id[0]])
+		{
+			print $id[0]."\t".$gametitle.".prg\n";
 		}
 	}
+}
 
-	if($_GET["start"])
+$r_query = array_flip($r_query);
+$start = explode("=", $r_query[0]);
+$start = $start[1];
+
+print "\nSearch for new uploads\n\n";
+
+for ($x = $start; $x < $start + 50; $x++)
+{
+	$query = implode('', file("http://intros.c64.org/main.php?module=showintro&iid=".$x));
+
+	if ($query != "Database error. Please contact us if this problem persists.") 
 	{
-		$start=$_GET["start"];
-		$fp = fopen($_GET["source"]."/ids.txt", "w");
-		fwrite($fp,	$start);
-		fclose($fp);
+		$gametitle = explode('', $query);
+		$gametitle = explode('', $gametitle[1]);
+		$gametitle = explode(' ', $gametitle[0]);
+		$gametitle[count($gametitle) - 1] = "(".$gametitle[count($gametitle) - 1].")";
+		$gametitle = implode(' ', $gametitle);
+
+		print $x."\t".$gametitle.".prg\n";
+
+		$last = $x;
 	}
 	else
 	{
-		$start=implode ('', file ($_GET["source"]."/ids.txt"));
+		print $x."\t".$query."\n";
 	}
+}
 
-	print "\nSearch for new uploads\n\n";
+if ($last)
+{
+	$start = $last + 1;
+}
 
-	for ($x=$start;$x<$start+50;$x++)
-	{
-		$query=implode ('', file ("http://intros.c64.org/main.php?module=showintro&iid=".$x));
-
-		if($query!="Database error. Please contact us if this problem persists.") 
-		{
-			$gametitle=explode ('', $query);
-			$gametitle=explode ('', $gametitle[1]);
-			$gametitle=explode (' ', $gametitle[0]);
-			$gametitle[count($gametitle)-1]="(".$gametitle[count($gametitle)-1].")";
-			$gametitle=implode (' ', $gametitle);
-
-			print $x."\t".$gametitle.".prg\n";
-
-			$last=$x;
-		}
-		else
-		{
-			print $x."\t".$query."\n";
-		}
-	}
-
-	if($last) $start=$last+1;
-
-	print "\nnext startnr\t".$start."";
+print "\nnext startnr\t".$start."";
 
 ?>
\ No newline at end of file
diff --git a/wizzardRedux/sites/C64intros.txt b/wizzardRedux/sites/C64intros.txt
index 343f784..4c691bd 100644
--- a/wizzardRedux/sites/C64intros.txt
+++ b/wizzardRedux/sites/C64intros.txt
@@ -1 +1,77 @@
-9643
\ No newline at end of file
+start=9643
+10
+3180
+36
+38
+59
+3009
+143
+145
+146
+147
+161
+180
+181
+225
+226
+234
+2681
+274
+469
+471
+472
+479
+569
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+607
+625
+626
+631
+632
+633
+635
+636
+637
+639
+640
+641
+647
+653
+666
+670
+671
+1398
+693
+771
+772
+778
+756
+757
+929
+1005
+1081
+1111
+1116
+1129
+1164
+1190
+1191
+1193
+1195
+1209
+1228
+349
diff --git a/wizzardRedux/sites/c16de.php b/wizzardRedux/sites/c16de.php
index 3ce2dbc..405b670 100644
--- a/wizzardRedux/sites/c16de.php
+++ b/wizzardRedux/sites/c16de.php
@@ -1,6 +1,8 @@
 check folders:\n\n";
 
-$newURLs=Array();
+foreach ($dirs as $dir)
+{
+	listDir($dir);
+}
 
-function listDir($dir){
-	GLOBAL $newURLs, $r_query;
+print "\nnew urls:\n\n";
+
+foreach ($found as $url)
+{
+	print "".$url."\n";
+}
+
+function listDir($dir)
+{
+	GLOBAL $found, $r_query;
 
 	print "load: ".$dir."\n";
 
-	$query=implode ('', file ($dir));
-	$query=explode('>Parent Directory<',$query);
-	if($query[1]){
-		$query=$query[1];
-	}else{
-		$query=$query[0];
+	$query = implode('', file($dir));
+	$query = explode('>Parent Directory<', $query);
+	if ($query[1])
+	{
+		$query = $query[1];
 	}
-	$query=str_replace(' HREF="',' href="',$query);
-	$query=explode(' href="',$query);
-	$query[0]=null;
+	else
+	{
+		$query = $query[0];
+	}
+	$query = str_replace(' HREF="', ' href="', $query);
+	$query = explode(' href="', $query);
+	$query[0] = null;
 
-	$new=0;
-	$old=0;
+	$new = 0;
+	$old = 0;
 
-	foreach($query as $row){
-		if($row){
-			$url=explode('"',$row);
-			$url=$dir.$url[0];
+	foreach ($query as $row)
+	{
+		if ($row)
+		{
+			$url = explode('"', $row);
+			$url = $dir.$url[0];
 
-			if(substr($url, -1)=='/'){
+			if (substr($url, -1) == '/')
+			{
 				listDir($url);
-			}else{
+			}
+			else
+			{
 				if(!$r_query[$url])
 				{
-					$newURLs[]=$url;
+					$found[] = $url;
 					$new++;
 				}
 				else
@@ -58,18 +77,4 @@ function listDir($dir){
 	print "new: ".$new.", old: ".$old."\n";
 }
 
-print "
check folders:\n\n";
-
-foreach($dirs as $dir)
-{
-	listDir($dir);
-}
-
-print "\nnew urls:\n\n";
-
-foreach($newURLs as $url)
-{
-	print "".$url."\n";
-}
-
 ?>
\ No newline at end of file
diff --git a/wizzardRedux/sites/c64com.php b/wizzardRedux/sites/c64com.php
index 8395313..a0a059d 100644
--- a/wizzardRedux/sites/c64com.php
+++ b/wizzardRedux/sites/c64com.php
@@ -1,72 +1,98 @@
 ";
-	print "load demos\n";
-	print "load games\n";
 
-	$url=Array(
-		'demos' => 'http://www.c64.com/demos/demos_show.php?showid=',
-		'games' => 'http://www.c64.com/games/no-frame.php?showid=',
-	);
+// Original code: The Wizard of DATz
+	
+print "
";
+print "load demos\n";
+print "load games\n";
+	
+$url = array(
+	'demos' => 'http://www.c64.com/demos/demos_show.php?showid=',
+	'games' => 'http://www.c64.com/games/no-frame.php?showid=',
+);
 
-	if($_GET["type"])
+$r_query = array_flip($r_query);
+$demos_start = explode("=", $r_query[0]);
+$demos_start = $demos_start[1];
+$games_start = explode("=", $r_query[1]);
+$games_start = $games_start[1];
+
+$demos_end = parse_games("demos", $demos_start);
+$games_end = parse_games("games", $games_start);
+
+/*
+// Handy AFTER we automatically download
+$handle = fopen("../sites/".$source.".txt", "w");
+fwrite($handle, "demos=".$demos_end);
+fwrite($handle, "games=".$games_end);
+fclose($handle);
+*/
+	
+function parse_games($type, $start)
+{
+	print "loading ".$type."\n";
+	
+	for ($x = $start; $x < $start + 50; $x++)
 	{
-		print "loading ".$_GET["type"]."\n";
-
-		if($_GET["start"])
+		$query = implode ('', file($url[$type].$x));
+		if ($type == 'demos')
 		{
-			$start=$_GET["start"];
-			$fp = fopen($_GET["source"]."/".$_GET["type"].".txt", "w");
-			fwrite($fp,	$start);
-			fclose($fp);
+			$query = explode('', $query);
+			$query = explode('', $query[1]);
+			$query = $query[0];
 		}
 		else
 		{
-			$start=implode ('', file ($_GET["source"]."/".$_GET["type"].".txt"));
+			$query = explode('', $query);
+			$query = explode('', $query[1]);
+			$query = $query[0];
 		}
-
-		for ($x=$start;$x<$start+50;$x++)
-		{
-			$query=implode ('', file ($url[$_GET["type"]].$x));
-			if($_GET["type"]=='demos'){
-				$query=explode('',$query);
-				$query=explode('',$query[1]);
-				$query=$query[0];
-			}else{
-				$query=explode('',$query);
-				$query=explode('',$query[1]);
-				$query=$query[0];
-			}
-
-			$gametitle=explode ('', $query);
-			$gametitle=explode ('', $gametitle[1]);
-			$gametitle=trim($gametitle[0]);
-
-			$addinfo=explode ('', $info);
-					$info=str_replace(array('(',')','?'),Array('','','x'),trim(strip_tags('".$gametitle.".zip\n";
-				$last=$x;
-			}else{
-				print $x."\tnot found\n";
-			}
-		}
-
-		if($last) $start=$last+1;
 	
-		print "\nnext startnr\t".$start."";
-
+		$gametitle = explode('', $query);
+		$gametitle = explode('', $gametitle[1]);
+		$gametitle = trim($gametitle[0]);
+	
+		$addinfo = explode('', $info);
+				$info = str_replace(array('(', ')', '?'), array('', '', 'x'), trim(strip_tags('".$gametitle.".zip\n";
+			$last = $x;
+		}
+		else
+		{
+			print $x."\tnot found\n";
+		}
 	}
+	
+	if ($last)
+	{
+		$start = $last + 1;
+	
+		print "\nnext startnr\t".$start."";
+	}
+	
+	return $start;
+}
 ?>
\ No newline at end of file
diff --git a/wizzardRedux/sites/c64com.txt b/wizzardRedux/sites/c64com.txt
index e69de29..f84ba6b 100644
--- a/wizzardRedux/sites/c64com.txt
+++ b/wizzardRedux/sites/c64com.txt
@@ -0,0 +1,2 @@
+demos=2305
+games=2420
\ No newline at end of file
diff --git a/wizzardRedux/sites/c64gamescom.php b/wizzardRedux/sites/c64gamescom.php
index e69de29..a869523 100644
--- a/wizzardRedux/sites/c64gamescom.php
+++ b/wizzardRedux/sites/c64gamescom.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/wizzardRedux/sites/c64gamesde.php b/wizzardRedux/sites/c64gamesde.php
index 121811f..60069e7 100644
--- a/wizzardRedux/sites/c64gamesde.php
+++ b/wizzardRedux/sites/c64gamesde.php
@@ -1,44 +1,44 @@
 ";
 
-	$r_query=implode ('', file ($_GET["source"]."/ids.txt"));
-	$r_query=explode ("\r\n","\r\n".$r_query);
-	$r_query=array_flip($r_query);
+$files = array();
 
-	$found=Array();
-	$files=Array();
-
-$translator=Array(
+$translator = array(
 	1 => 'c',
 	2 => 't',
 	3 => 'd',
 	4 => 'o',
 );
 
-$translator2=Array(
+$translator2 = array(
 	'c' => 'Cartridge',
 	't' => 'Tape',
 	'd' => 'Disk',
 	'o' => 'Original',
 );
 
-for($x=1;$x<=4;$x++)
+for ($x = 1; $x <= 4; $x++)
 {
 	$dir = "http://c64games.de/phpseiten/spiele.php?aufruf=true&medium=".$x;
 
-	$old=0;
-	$new=0;
+	$old = 0;
+	$new = 0;
 
-	$query=implode ('', file ($dir));
-	$query=explode ('spieledetail.php?filnummer=', $query);
-	$query[0]=null;
+	$query = implode('', file($dir));
+	$query = explode('spieledetail.php?filnummer=', $query);
+	$query[0] = null;
 
-	foreach($query as $row){
-		if($row){
-			$row=explode ('"', $row);
-			$row=$row[0];
+	foreach ($query as $row)
+	{
+		if ($row)
+		{
+			$row = explode('"', $row);
+			$row = $row[0];
 
-			$found[$row]=$row;
+			$found[$row] = $row;
 			$new++;
 		}
 	}
@@ -51,42 +51,47 @@ foreach($found as $id)
 {
 	$dir = "http://c64games.de/phpseiten/spieledetail.php?filnummer=".$id;
 
-	$old=0;
-	$new=0;
+	$old = 0;
+	$new = 0;
 
-	$query=implode ('', file ($dir));
-	$query=explode ('../hugo.php?art=', $query);
+	$query = implode('', file($dir));
+	$query = explode('../hugo.php?art=', $query);
 
-	$titel=explode (' ', $query[0]);
-	$titel=explode (' ', $titel[1]);
-	$titel=$titel[0];
+	$titel = explode(' ', $query[0]);
+	$titel = explode(' ', $titel[1]);
+	$titel = $titel[0];
 
-	$year=explode ('Jahr:', $query[0]);
-	$year=explode ('<', $year[1]);
-	$year=$year[0];
+	$year = explode('Jahr:', $query[0]);
+	$year = explode('<', $year[1]);
+	$year = $year[0];
 
-	$Eingespielt=explode ('Eingespielt am: ', $query[0]);
-	$Eingespielt=explode ('<', $Eingespielt[1]);
-	$Eingespielt=date('Ymd',strtotime($Eingespielt[0]));
+	$Eingespielt = explode('Eingespielt am: ', $query[0]);
+	$Eingespielt = explode('<', $Eingespielt[1]);
+	$Eingespielt = date('Ymd', strtotime($Eingespielt[0]));
 
-	$manufactor=explode ('Hersteller:', $query[0]);
-	$manufactor=explode ('<', $manufactor[1]);
-	$manufactor=$manufactor[0];
+	$manufactor = explode('Hersteller:', $query[0]);
+	$manufactor = explode('<', $manufactor[1]);
+	$manufactor = $manufactor[0];
 
-	$query[0]=null;
+	$query[0] = null;
 
-	foreach($query as $row){
-		if($row){
-			$row=explode ('"', $row);
-			$row=$row[0];
+	foreach ($query as $row)
+	{
+		if ($row)
+		{
+			$row = explode('"', $row);
+			$row = $row[0];
 
-			$ext=explode ('.', $row);
-			$ext=$ext[count($ext)-1];
+			$ext = explode('.', $row);
+			$ext = $ext[count($ext) - 1];
 
-	    	if($r_query[$Eingespielt.'#'.$id]){
+	    	if ($r_query[$Eingespielt.'#'.$id])
+	    	{
 				$old++;
-			}else{
-				$files[]=Array($Eingespielt.'#'.$id,$row,$titel." (".$manufactor.") (".$year.") (".$translator2[$row[0]].").".$ext);
+			}
+			else
+			{
+				$files[] = array($Eingespielt.'#'.$id, $row, $titel." (".$manufactor.") (".$year.") (".$translator2[$row[0]].").".$ext);
 				$new++;
 			}
 		}
@@ -98,12 +103,15 @@ foreach($found as $id)
 	
 print "
";
 
-foreach($files as $row){
+foreach
+($files as $row)
+{
 	print $row[0]."\n";
 }
-	print "
";
+print "
";
 
-foreach($files as $row){
+foreach ($files as $row)
+{
 	print "".$row[2]."\n";
 }