COUNTRIES

NEW COUNTRY

'; echo'
Icon-Upload: (18x12)
Country:
Shorthandle:
'; } elseif($_GET["action"]=="edit") { $ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."countries WHERE countryID='".$_GET["countryID"]."'")); $pic=''.$ds['country'].''; echo'

COUNTRIES

EDIT COUNTRY - '.$ds['country'].'

'; echo'
present icon: '.$pic.'
Icon-Upload: (18x12)
Country:
Shorthandle:
'; } elseif($_POST["save"]) { $icon=$_FILES["icon"]; $country=$_POST["country"]; $short=$_POST["shorthandle"]; echo'

COUNTRIES

NEW COUNTRY

'; if($country AND $short) { $file_ext=strtolower(substr($icon[name], strrpos($icon[name], "."))); if($file_ext==".gif") { safe_query("INSERT INTO ".PREFIX."countries (countryID, country, short) values('', '".$country."', '".$short."')"); if($icon[name] != "") { move_uploaded_file($icon[tmp_name], $filepath.$icon[name]); $file=$short.$file_ext; rename($filepath.$icon[name], $filepath.$file); redirect("admincenter.php?site=countries","",0); } } else echo'The format of the icon was incorrect. Please upload only icons in *.gif format.

« back'; } else echo'Please fill in the form correctly.

« back'; } elseif($_POST["saveedit"]) { $icon=$_FILES["icon"]; $country=$_POST["country"]; $short=$_POST["shorthandle"]; echo'

COUNTRIES

EDIT COUNTRY

'; if($country AND $short) { if($icon[name]=="") { if(safe_query("UPDATE ".PREFIX."countries SET country='".$country."', short='".$short."' WHERE countryID='".$_POST["countryID"]."'")) header("Location: admincenter.php?site=countries"); } else { $file_ext=strtolower(substr($icon[name], strrpos($icon[name], "."))); if($file_ext==".gif") { move_uploaded_file($icon[tmp_name], $filepath.$icon[name]); @chmod($filepath.$icon[name], 0755); $file=$short.$file_ext; rename($filepath.$icon[name], $filepath.$file); if(safe_query("UPDATE ".PREFIX."countries SET country='".$country."', short='".$short."' WHERE countryID='".$_POST["countryID"]."'")) { header("Location: admincenter.php?site=countries"); } } else echo'The format of the icon was incorrect. Please upload only icons in *.gif format.

« back'; } } else echo'Please fill in the form correctly.

« back'; } elseif($_GET["delete"]) { safe_query("DELETE FROM ".PREFIX."countries WHERE countryID='".$_GET["countryID"]."'"); redirect("admincenter.php?site=countries","",0); } else { echo'

COUNTRIES

existing countries

'; $ds=safe_query("SELECT * FROM ".PREFIX."countries ORDER BY country"); $anz=mysql_num_rows($ds); if($anz) { while($flags = mysql_fetch_array($ds)) { $pic=''.$flags[country].''; echo' '; } } else echo'
Icon: Country: Shorthandle: Actions:
'.$pic.' '.$flags[country].' '.$flags[short].'
no entries
'; } ?>