<?php
include 'config.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>File browser</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="filebrowsertopsection">
<p align="center"><strong>File browser :: <a href="./">Home</a></strong><br>
Browse by: <a href="?order=files">file names</a> :: <a href="?order=grouped">file names grouped</a> :: <a href="?order=filepath">files names and paths</a> :: <a href="?order=imdb">IMDB information browser</a></p>
</div>
<?php
//straight file list
if (!$_GET['order'])
{
$order = 'files';
}
else
{
$order = $_GET['order'];
};
if ($order=='files')
{
echo "
<div class=\"filebrowserfilesonly\">
<p><strong>File names - click to watch as flash video</strong></p>
<ul>";
$results = mysql_query("SELECT filename,id,path FROM movie_scanresults order by filename limit 0,500");
while($row = mysql_fetch_assoc($results))
{
$filename = rawurlencode($row[filename]);
$path = rawurlencode($row[path]);
echo "<li>
<form action=\"encoder.php\" method=\"post\"><input type='hidden' value='".$filename."' name='fname' /><input type='hidden' value='".$path."/".$filename."' name='fullfile' />
<input type=\"Submit\" name='Submit' class=\"filebrowserfilesonly\" value=\"".$row[filename]."\" />
</form>
</li>
";
};
echo "
</ul>
</div>";
}
elseif ($order=='grouped')
{
echo "
<div class=\"filebrowserfilesonly\">
<p><strong>File names - click to watch as flash video</strong></p>
<ul>";
$sql = "SELECT filename,id,path FROM movie_scanresults where id not in (select child_id from movie_matches) order by filename limit 0,500";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results))
{
$filename = rawurlencode($row[filename]);
$path = rawurlencode($row[path]);
echo "<li>
<form action=\"encoder.php\" method=\"post\"><input type='hidden' value='".$filename."' name='fname' /><input type='hidden' value='".$path."/".$filename."' name='fullfile' />
<input type=\"Submit\" name='Submit' class=\"filebrowserfilesonly\" value=\"".$row[filename]."\" />
</form>
";
// now show children --- needs work
$sql1 = "SELECT filename,id,path FROM movie_scanresults where id in (select child_id from movie_matches where parent_id = ".$row[id].")";
$results1 = mysql_query($sql1);
while($row1 = mysql_fetch_assoc($results1))
{
$filename = rawurlencode($row1[filename]);
$path = rawurlencode($row1[path]);
echo "
<form action=\"encoder.php\" method=\"post\"><input type='hidden' value='".$filename."' name='fname' /><input type='hidden' value='".$path."/".$filename."' name='fullfile' />
<input type=\"Submit\" name='Submit' class=\"filebrowserfilesonly\" value=\"".$row1[filename]."\" />
</form>";
};
echo "</li>";
};
echo "
</ul>
</div>";
}
elseif ($order=='filepath')
{
echo "
<div class=\"filebrowserfilesonly\">
<p><strong>File names - click to watch as flash video</strong></p>
<ul>";
$results = mysql_query("SELECT filename,id,path FROM movie_scanresults order by filename limit 0,500");
while($row = mysql_fetch_assoc($results))
{
$filename = rawurlencode($row[filename]);
$path = rawurlencode($row[path]);
echo "<li>
<form action=\"encoder.php\" method=\"post\">
<input type='hidden' value='".$filename."' name='fname' />
<input type='hidden' value='".$path."/".$filename."' name='fullfile' />
<input type=\"Submit\" name='Submit' class=\"filebrowserfilesonly\" value=\"".$row[path]."/".$row[filename]."\" />
</form>
</li>
";
};
echo "
</ul>
</div>";
}
elseif ($order=='imdb')
{
echo "
<div class=\"filebrowserfilesonly\">
<p><strong>File names - click to watch as flash video</strong></p>
<ul>";
$results = mysql_query("SELECT s.filename,s.id,s.path,n.imdb_ref FROM movie_scanresults s,movie_name_imdb n where s.id = n.movie_scanresults_id order by s.filename limit 0,500");
while($row = mysql_fetch_assoc($results))
{
$filename = rawurlencode($row[filename]);
$path = rawurlencode($row[path]);
echo "<li>
<form action=\"encoder.php\" method=\"post\">
<input type='hidden' value='".$filename."' name='fname' />
<input type='hidden' value='".$path."/".$filename."' name='fullfile' />
<input type=\"Submit\" name='Submit' class=\"filebrowserfilesonly\" value=\"".$row[filename]."\" /> <a href = \"http://www.imdb.com/title/tt".$row[imdb_ref]."\" target = \"_blank\">IMDB link</a>
</form>
</li>
";
};
echo "
</ul>
</div>";
}
else
{
echo "Mystery option not in progress. Try using a link and not making stuff up.";
};
?>