<?php
include("pptfiles.php");
$i = 0;
$firstnum = "";
$secondnum = "";
if (is_array($argv)) {
	$arraydump = var_export($argv, true);
	foreach ($argv as $value):
		$i = $i + 1;
		if ($i == 2) { $firstnum = $value; }
		else if ($i == 3) { $secondnum = $value; }
		else if ($i == 4) { $thirdnum = $value; }
		else if ($i == 5) { $fourthnum = $value; }
	endforeach;
	if (($thirdnum == 127) && ($fourthnum == 127)) { $ignoresecondnote = 1; }
	if (($thirdnum == 0) && ($fourthnum == 0)) { $ignoresecondnote = 1; }
	if ($secondnum == 127) { $secondnum = 0; } else if ($secondnum == 0) { $secondnum = ""; }
	if ($thirdnum == 127) { $thirdnum = 0; } else if ($thirdnum == 0) { $thirdnum = ""; }
	if ($fourthnum == 127) { $fourthnum = 0; } else if ($fourthnum == 0) { $fourthnum = ""; }
	if (!$ignoresecondnote > 0) { $pptid = $firstnum . $secondnum . $thirdnum . $fourthnum; } else $pptid = $firstnum . $secondnum;
}
if ((isset($pptid)) && ($pptid != "")) {
	$pptfilename = $pptfiles[$pptid]['filename'];
	$fp = fopen("c:\\localppt\\logs.txt", "w");
	$message = "First Num: $firstnum, Second Num: $secondnum, pptid: $pptid, filename: $pptfilename, opening: c:\\localppt\\$pptfilename " . $arraydump;
	fwrite($fp, $message);
	fclose($fp);
	exec("c:\\localppt\\$pptfilename");
} 
?>