rendered paste body // open the current directory by opendir
$handle=opendir("./images/photoalbum/");
?>
<html>
<head>
<title>Wreck Creations Photoalbum Setup v2</title>
<script language="javascript" type="text/javascript" src="./script.js"></script>
<body>
<form action='./photoalbum.php?mode=setup_v2' method='post' enctype='multipart/form-data'>
<table><tr>
<?php
$counter=0;
$table_counter=-1;
$ignore = "false";
while (($file = readdir($handle))!==false) {
//echo $file."<br>";
/****
if($file==".." || $file=="." || $file=="...") {
$table_counter=0;
$ignore = "true";
//do nothing
}
***/
$cleanfile=preg_replace("[ ]","+",$file);
//echo $cleanfile;
$query=mysql_query("SELECT * FROM `photoalbum`") or trigger_error("MYSQL ERROR: ".mysql_error());
$info=mysql_fetch_array($query);
if($info['name'] == $cleanfile) {
//echo "<br>File $file already in database";
$ignore = "true";
}
//echo "<br>".$ignore;
if($info['name'] != $cleanfile && $file != ".." && $file != "." && $file != "...") {
if($table_counter==4) {
echo "</tr><tr>";
unset($table_counter);
$table_counter=1;
//echo "<td>restarted";
}
?>
<td>
<script language="javascript" type="text/javascript">
getPage('','groupdiv<?php echo $counter; ?>');
</script>
<a href="./images/photoalbum/<?php echo $file; ?>" target="_blank"><img src="./photoalbum.php?mode=resize_image&file=<?php echo $file; ?>"></img></a>
<br><a href="javascript:getPage('','groupdiv<?php echo $counter; ?>'); setDiv('subgroupdiv<?php echo $counter; ?>')" id="thingy">Refresh Groups</a>
<div id='groupdiv<?php echo $counter; ?>'>If your seeing this then something is wrong</div>
<div id='subgroupdiv<?php echo $counter; ?>'>Please select a group</div>
<p>Phase: <select name="bma<?php echo $counter; ?>"><option value="b">Before</option><option value="m">Middle</option><option value="a">After</option></select>
<p>Short Descricption(optional) <input name="dec<?php echo $counter ?>">
<input type="hidden" name="filename<?php echo $counter; ?>" value="<?php echo $cleanfile; ?>">
<?php
}
$ignore = "false";
$counter++;
$table_counter++;
}
echo "</tr></table>";
echo "<input type=\"hidden\" name=\"totalvars\" value=\"$counter\"><p><input type=\"submit\" value=\"Submit\" name=\"submiters\">";