If you post up that chunk, I might be able to help with knowing where to look to modify it all?
$edit_dir=$_GET['edit_dir'];
$dir_selected=0;
if ($_GET['dir_selected']) {$dir_selected=$_GET['dir_selected'];};
//if ($_POST['dir_selected']) {$dir_selected=$_POST['dir_selected'];};
$tmp = getDirectoryList();
$dir_selected = !empty($tmp[$dir_selected])?$tmp[$dir_selected]

dir_selected;
if ($edit_dir!='') {
print '<table><tr><td style="color:#ffffff">'."\n";
print "<form action=\"admin.php\" method=\"post\">\n";
print "Category to rename:<br />\n";
print "<b>".getNameByDir($edit_dir)."</b><br />\n";
print "<input name=\"ren_dir\" type=\"hidden\" value=\"$edit_dir\" /><br />\n";
print "New category name:<br />\n";
print "<input name=\"ren_dir2\" type=\"text\" /><br />\n";
print "<input type=\"submit\" /></form>\n";
print "</td></tr></table>\n";
print "</body></html>";
} else {
include("inc/top.php");
// rename category
$ren_dir=$_POST['ren_dir'];
$ren_dir2=$_POST['ren_dir2'];
if (($ren_dir!='')&&($ren_dir2!='')) {
///rename($gallery_path."/".$ren_dir, $gallery_path."/".$ren_dir2);
renameCategory($ren_dir,$ren_dir2);
};
// add new category
if (!empty($_POST['new_dir']))
{
$handle = fopen("categories.mdb", "a+");
$new_dir = getmicrotime();
fwrite($handle,$_POST['new_dir']."|".$new_dir."\n");
mkdir($gallery_path."/".$new_dir, 0777);
mkdir($gallery_path."/".$new_dir."/pix", 0777);
mkdir($gallery_path."/".$new_dir."/thumbs", 0777);
}
// delete category
$del_dir=$_GET['del_dir'];
if (($del_dir!='')) {
delRowByDir($_GET['del_dir']);
$Open=opendir($gallery_path."/".$del_dir."/thumbs");
if ($Open) {
while ($Files=readdir($Open)) {
if (($Files!='.')&&($Files!='..')) {
if (file_exists($gallery_path."/".$del_dir."/thumbs/".$Files)) {
unlink($gallery_path."/".$del_dir."/thumbs/".$Files);
};
if (file_exists($gallery_path."/".$del_dir."/pix/".$Files)) {
unlink($gallery_path."/".$del_dir."/pix/".$Files);
};
};
};
};
$tmp=rmdir($gallery_path."/".$del_dir."/pix");
$tmp=rmdir($gallery_path."/".$del_dir."/thumbs");
if (file_exists($gallery_path."/".$del_dir."/settings.dat")) {
unlink($gallery_path."/".$del_dir."/settings.dat");
};
$tmp=rmdir($gallery_path."/".$del_dir);
};
// sort categories
if(isset($_POST['cats'])){
$str = "";
foreach($_POST['cats'] as $v ){
$str .= getNameByDir($v)."|".$v."\n";
}
$handle = fopen("categories.mdb", "w");
fwrite($handle,$str);
}
// sort files
if(isset($_POST['pics'])){
$str = "";
foreach($_POST['pics'] as $v ){
if(!empty($v))
$str .= trim($v)."\n";
}
$handle = fopen($gallery_path."/".$dir_selected."/settings.dat", "w");
fwrite($handle,$str);
}
//
echo '<script src="inc/ui.base.js"></script>
<script src="inc/ui.sortable.js"></script>';
$dirs_count=0;
$category_settings='';
$Open=opendir($gallery_path);
print '<form method="post" id="f1"><ul id="myList">';
$cats = getDirectoryList();
foreach($cats as $Files){
// if (!is_file($Files)&&$Files!='.'&&$Files!='..') {
print '<li style="color:#ffffff">';
print "<input type='hidden' name='cats[]' value='".$Files."'>";
print "<a href=\"admin.php?del_dir=$Files\" class=\"menu_2\"><img src=\"pics/delete.gif\" border=0 alt=\"delete\"></a> ";
print "<a href=\"admin.php?edit_dir=$Files\" class=\"menu_2\"><img src=\"pics/edit.gif\" border=0 alt=\"edit\"></a> ";
if ($dir_selected==$Files) {
$selectDir=$Files;
print "<a href=\"admin.php?dir_selected=$dirs_count\" class=\"menu_1\">".getNameByDir($Files)."</a>";
//read category settings
$FileName="$gallery_path/$Files/settings.dat";
if (is_file($FileName)) {
$File=fopen($FileName,'r');
if (filesize($FileName)>0) {
$category_settings=fread($File,filesize($FileName));
};
fclose($File);
};
} else {
print "<a href=\"admin.php?dir_selected=$dirs_count\" class=\"menu_2\">".getNameByDir($Files)."</a>";
};
print '</li>';
$dirs_count++;
// };
};
print '</ul>';
?><img src="pics/sort.jpg" title="Sort Galleries" style="cursor

ointer; margin-left:10px;" onclick="if(this.src.indexOf('sort') != -1){$('#myList').sortable({});this.src = 'pics/save.jpg'}else{$('#myList').sortable('disable');document.getElementById('f1').submit()}" />
</form><?
print '<br><br><table width="100%"><tr><td style="color:#FFFFFF "><strong class="white" style=" font-size:11px "> Add new category:</strong><br /><br /><form action="admin.php" method="post"><input name="dir_selected" type="hidden" value="'.$dir_selected.'"><input type="text" name="new_dir" style="border:1px solid #777777; border-style:solid; background-color:#000000; color:#777777 "><br><input name="OK" type="submit" value="" style="width:51px; height:21px; border-width:0px; margin-left:5px; padding-top:5 px; margin-top:10px; border-style:solid; background-image:url(pics/add.jpg)"></form></td></tr></table>';
print "</td><td>";
//select image - save category settings
$select_file=$_GET['select_file'];
if (($select_file!='')&&($dirs_count!=0)) {
$FileName="$gallery_path/$selectDir/settings.dat";
$File=fopen($FileName,'w');
fwrite($File,$select_file);
fclose($File);
$category_settings=$select_file;
};
// add new picture
if (isset($_FILES["new_file"])) {
if (is_uploaded_file($_FILES['new_file']['tmp_name'])) {
$filename = $_FILES['new_file']['tmp_name'];
$upload_name = $_FILES['new_file']['name'];
$ext = substr($_FILES['new_file']['name'],
1 + strrpos($_FILES['new_file']['name'], "."));
$size = GetImageSize($filename);
if (($size)&&($size[0]<=$pic_max_size_x)&&($size[1]<=$pic_max_size_y)) {
if (copy($filename, $gallery_path."/".$dir_selected."/pix/".$upload_name)) {
require ('inc/imgresize.php');
$handle = fopen($gallery_path."/".$dir_selected."/settings.dat", "a+");
fwrite($handle,$upload_name."\n");
img_resize($filename, $gallery_path."/".$dir_selected."/thumbs/".$upload_name, $thumb_size_x, $thumb_size_y);
};
unlink($filename);
} else {
print "<center><strong class=\"white\" style=\" font-size:11px \">Size of new picture is very large. Please resize this.<br /><br />";
print "Maximum size of new picture must be: ".$pic_max_size_x."x".$pic_max_size_y."</center><br /><br />";
};
};
};
// delete picture
$delete_file=$_GET['delete_file'];
if ($delete_file) {
unlink($gallery_path."/".$dir_selected."/thumbs/".$delete_file);
unlink($gallery_path."/".$dir_selected."/pix/".$delete_file);
$arr = file($gallery_path."/".$dir_selected."/settings.dat");
$str = "";
foreach($arr as $v){
if(trim($v) != trim($delete_file) && !empty($v))
$str .= trim($v)."\n";
}
$handle = fopen($gallery_path."/".$dir_selected."/settings.dat", "w");
fwrite($handle,$str);
};
//
print '<br><br><table width="100%" style="margin-left:15px; margin-top:0px;"><tr><td colspan="3"><strong class="white" style=" font-size:11px ">Add new picture:</strong><form enctype="multipart/form-data" method="post"><input name="dir_selected" type="hidden" value="'.$dir_selected.'"><input type="file" name="new_file" style="border:1px solid #777777; border-style:solid; background-color:#000000; color:#ffffff; width:200px; "> <input name="OK" type="submit" value="" style="width:51px; height:21px; border-width:0px; margin-left:20px; border-style:solid; background-image:url(pics/add.jpg)"></form></td></tr></table>';
?> <form method="POST" id="f2">
<img style="cursor

ointer; margin-left:30px;" title="Sort Images" src="pics/sort.jpg" onclick="if(this.src.indexOf('sort') != -1){$('#myList1').sortable({});this.src = 'pics/save.jpg'}else{$('#myList1').sortable('disable');document.getElementById('f2').submit()}" /><br />
<ul qwidth="100%" id="myList1" qbgcolor="#161616" qstyle="margin:0px; height:50px;">
<?
$Open=file($gallery_path."/".$selectDir."/settings.dat");
foreach($Open as $Files) {
?>
<li style="clear:both; height:50px; padding:0px; background-color:#313131" bgcolor="#2d2d2d">
<div style="float:left; height:50px; width:50px; border-right:#161616 5px solid; text-align:center;" >
<div style="height:17px;"></div>
<a href="admin.php?delete_file=<?php echo $Files ?>&dir_selected=<?php echo $dir_selected ?>">
<img src="pics/delete.gif" border=0 alt="delete">
</a>
</div>
<div style="float:left; height:50px; width:50px; border-right:#161616 5px solid;">
<a href="<?php echo $gallery_path?>/<?php echo $selectDir ?>/pix/<?php echo $Files ?>">
<img src="<?php echo $gallery_path ?>/<?php echo $selectDir ?>/thumbs/<?php echo $Files ?>" border="0" width="50" height="50">
</a>
</div>
<div style="float:left; height:50px; padding-left:28px; color:#FFFFFF;">
<div style="height:17px;"></div>
<?php echo $Files ?>
<input type='hidden' name='pics[]' value='<?php echo $Files ?>'>
</div>
</li>
<?
};
?>
</ul>
</form>
<?
include("inc/bottom.php");
};
};
?>