Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
AminCP Add,edit,delete countries
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

Unknown User
2019-08-01 10:15:06
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]


///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&amp;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&amp;do=edit&amp;id=$id'>[EDIT]</a> <a href='admincp?action=countrys&amp;do=delete&amp;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&amp;do=edit&amp;id=$id&amp;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&amp;do=delete&amp;id=$id&amp;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&amp;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
countrys.jpg
countrys.jpg
countries1.zip
Download
countries2.zip
Download
Unknown User
2019-08-01 10:18:02
ive noticed some of the autolinks arnt working :unsure:
edit: now working
2019-08-01 18:41:18
Not Found

The requested URL /admincp was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Unknown User
2019-08-01 19:54:23
my damm clean urls ? admincp link updated ill need to upload countries folder as its not defualt in V3 as i thourght
2019-08-02 03:36:17
Nice mod, you could use language image folder to save having two folders with flags
Unknown User
2019-08-02 05:34:28
first post updated
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728