so i noticed my country wasent listed in the drop down list for user country so i modified the edit languages from admincp to do the job
[color=rgb(41, 105, 176)]in admincp before the last <? add[/color]
add a link into admincp
add to languages/english.php
add to images/admin
[ATTACH]5128[/ATTACH]
edit: added a check to see if country was already added first post updated
add the countries 1 and 2 into images/languages
[color=rgb(41, 105, 176)]in admincp before the last <? add[/color]
///start countrys
if ($action=="countrys" && $do=="view"){
stdhead(T_("COUNTRYS"));
navmenu();
begin_frame(T_("COUNTRYS"));
echo '<br />';
echo '<br />';
echo "<center><a href='admincp?action=countrys&do=add'><b>Add New country</b></a></center><br />";
print("<i><center>Please note that country image is optional</i><br /><br /></center>");
echo("<center><table width='95%' class='table_table'><tr>");
echo("<th class='table_head'><b>".T_("NAME")."</b></th><th class='table_head'><b>Image</b></th><th width='30' class='table_head'></th></tr>");
$query = "SELECT * FROM countries ORDER BY name ASC";
$sql = SQL_Query_exec($query);
while ($row = mysqli_fetch_array($sql)) {
$id = $row['id'];
$name = $row['name'];
$flagpic = $row['flagpic'];
print("<tr><td class='table_col1'>$name</td><td class='table_col2' align='center'>");
if (isset($row["flagpic"]) && $row["flagpic"] != "")
print("<img border=\"0\" src=\"" . $site_config['SITEURL'] . "/images/languages/" . $row["flagpic"] . "\" alt=\"" . $row["name"] . "\" />");
else
print("-");
print("</td><td class='table_col1'><a href='admincp?action=countrys&do=edit&id=$id'>[EDIT]</a> <a href='admincp?action=countrys&do=delete&id=$id'>[DELETE]</a></td></tr>");
}
echo("</table></center>");
end_frame();
stdfoot();
}
if ($action=="countrys" && $do=="edit"){
stdhead(T_("COUNTRYS_MANAGEMENT"));
navmenu();
$id = (int)$_GET["id"];
if (!is_valid_id($id))
show_error_msg(T_("ERROR"),T_("INVALID_ID"),1);
$res = SQL_Query_exec("SELECT * FROM countries WHERE id=$id");
if (mysqli_num_rows($res) != 1)
autolink("admincp.php?action=countrys&do=view", "No country with ID $id.");
$arr = mysqli_fetch_array($res);
if ($_GET["save"] == '1'){
$name = $_POST['name'];
if ($name == "")
show_error_msg(T_("ERROR"), "country name cannot be empty!",1);
$domain = $_POST['domain'];
$image = $_POST['image'];
$name = sqlesc($name);
$image = sqlesc($image);
$domain = sqlesc($domain);
SQL_Query_exec("UPDATE countries SET name=$name, flagpic=$image, domain=$domain WHERE id=$id");
autolink("admincp.php?action=countrys&do=view", "country was edited successfully.");
} else {
begin_frame("Edit country");
print("<form method='post' action='?action=countrys&do=edit&id=$id&save=1'>\n");
print("<center><table border='0' cellspacing='0' cellpadding='5'>\n");
print("<tr><td align='left'><b>Name: </b><input type='text' name='name' value=\"".$arr['name']."\" /></td></tr>\n");
print("<tr><td align='left'><b>Image: </b><input type='text' name='image' value=\"".$arr['flagpic']."\" /> single filename</td></tr>\n");
print("<tr><td align='left'><b>Domain: </b><input type='text' name='domain' value=\"".$arr['domain']."\" /></td></tr>\n");
print("<tr><td align='center'><input type='submit' value='Submit' /></td></tr>\n");
print("</table></center>\n");
print("</form>\n");
end_frame();
}
stdfoot();
}
if ($action=="countrys" && $do=="delete"){
stdhead(T_("COUNTRY_MANAGEMENT"));
navmenu();
$id = (int)$_GET["id"];
if ($_GET["sure"] == '1'){
if (!is_valid_id($id))
show_error_msg(T_("ERROR"),"Invalid country item ID",1);
SQL_Query_exec("DELETE FROM countries WHERE id=$id"); //delete old country
autolink("admincp.php?action=countrys&do=view", "Country Deleted.");
}else{
begin_frame("Delete country");
print("<form method='post' action='?action=countrys&do=delete&id=$id&sure=1'>\n");
print("<center><table border='0' cellspacing='0' cellpadding='5'>\n");
print("<tr><td align='center'><input type='submit' value='Submit' /></td></tr>\n");
print("</table></center>\n");
print("</form>\n");
}
end_frame();
stdfoot();
}
if ($action=="countrys" && $do=="takeadd"){
$name = $_POST['name'];
if ($name == "")
autolink("admincp.php?action=countrys&do=view", "Name cannot be empty!.");
$domain = $_POST['domain'];
$image = $_POST['image'];
$name = sqlesc($name);
$image = sqlesc($image);
$domain = sqlesc($domain);
$check="SELECT * FROM countries WHERE name = '$_POST[name]'";
$rs = SQL_Query_exec($check);
$data = mysqli_fetch_array($rs, MYSQLI_NUM);
if($data[0] > 1) {
autolink("admincp.php?action=countrys&do=view", "Country Already Exists!");
}
else
{
SQL_Query_exec("INSERT INTO countries (name, flagpic, domain) VALUES ($name, $image, $domain)");
}
if (mysqli_affected_rows($GLOBALS["DBconnector"]) == 1) {
autolink("admincp.php?action=countrys&do=view", "country was added successfully");
}
else
{
autolink("admincp.php?action=countrys&do=view", "Unable to add country");
}
}
if ($action=="countrys" && $do=="add"){
stdhead(T_("COUNTRYS_MANAGEMENT"));
navmenu();
begin_frame("Add country");
print("<center><form method='post' action='admincp'>\n");
print("<input type='hidden' name='action' value='countrys' />\n");
print("<input type='hidden' name='do' value='takeadd' />\n");
print("<table border='0' cellspacing='0' cellpadding='5'>\n");
print("<tr><td align='left'><b>Name:</b> <input type='text' name='name' /></td></tr>\n");
print("<tr><td align='left'><b>Image:</b> <input type='text' name='image' /></td></tr>\n");
print("<tr><td align='left'><b>Domain:</b> <input type='text' name='domain' /></td></tr>\n");
print("<tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>\n");
print("</table></form><br /><br /></center>\n");
end_frame();
stdfoot();
}
//end countrys
add a link into admincp
<td align="center"><a href="admincp.php?action=countrys&do=view"><img src="images/admin/country.jpg" border="0" width="32" height="32" alt="" /><br /><?php echo T_("COUNTRY_MANAGEMENT"); ?></a><br /></td
add to languages/english.php
$LANG["COUNTRY_MANAGEMENT"] = "Countries Management";
$LANG["COUNTRYS"] = "Countries";
add to images/admin
[ATTACH]5128[/ATTACH]
edit: added a check to see if country was already added first post updated
add the countries 1 and 2 into images/languages

