'Australia', 'AUT' => 'Austria', 'Awa' => 'Awards Ceremonies', 'awa' => 'Awards Ceremonies', 'BER' => 'Bermuda', 'BIG' => 'Bosnia', 'BUL' => 'Bulgaria', 'BRA' => 'Brazil', 'CAN' => 'Canada', 'CZE' => 'Czech Republic', 'FRA' => 'France', 'GER' => 'Germany', 'GBR' => 'Great Britain', 'GRE' => 'Greece', 'HUN' => 'Hungary', 'IRE' => 'Ireland', 'ITA' => 'Italy', 'JPN' => 'Japan', 'LAT' => 'Latvia', 'MIS' => 'Miscellaneous', 'MON' => 'Monaco', 'NED' => 'Netherlands', 'NZL' => 'New Zealand', 'NOR' => 'Norway', 'POL' => 'Poland', 'ROM' => 'Romania', 'RUS' => 'Russia', 'SRB' => 'Serbia', 'SVK' => 'Slovakia', 'SWE' => 'Sweden', 'SUI' => 'Switzerland', 'ISV' => 'US Virgin Islands', 'USA' => 'USA', ); while (false !== ($filename = readdir($dir))) { if($filename != '.' and $filename != '..') { $files[] = $filename; } } sort($files); mysql_connect("mysql09.powweb.com",'fti','friend3'); mysql_select_db("bobsleighphotos"); if(!isset($_POST['doadding'])) { $cats = array(); $res = mysql_query("SELECT cd.categories_name, cd.categories_id,c.parent_id FROM zc_categories c, zc_categories_description cd WHERE cd.categories_id = c.categories_id ORDER BY cd.categories_name;"); # gather all categories while($row = mysql_fetch_assoc($res)) { $cats[] = $row; } # retrieve all the categories hierarchically $options = ''; for($idx = 0; $idx < count($cats); $idx++) { if($cats[$idx]['parent_id'] != 0) { for($c = 0; $c < count($cats); $c++) { if($cats[$c]['categories_id'] == $cats[$idx]['parent_id']) { $cats[$c]['subcategories'][] = $cats[$idx]; break; } } } } print "
"; } else { foreach($files as $file) { $name = str_replace('.','_',$file); $name = str_replace(' ','_',$name); $width = $_POST['width_'.$name]; $height = $_POST['height_'.$name]; $title = $_POST['title_'.$name]; $cat = $_POST['cat_'.$name]; $desc = "Width: {$width}px