}
         //die(implode(",",$values));
         mysql_query("DELETE FROM {$TABLE_PREFIX}settings") or stderr($language["ERROR"], mysql_error());
         mysql_query("INSERT INTO {$TABLE_PREFIX}settings (`key`,`value`) VALUES " . implode(",", $values) . ";") or stderr($language["ERROR"], mysql_error());
         // update guest values for language, style, torrentsxpage etc...
         mysql_query("UPDATE {$TABLE_PREFIX}users SET language=" . sqlesc($btit_settings["default_language"]) . ",\r\n                            style=" . sqlesc($btit_settings["default_style"]) . ",\r\n                            torrentsperpage=" . sqlesc($btit_settings["max_torrents_per_page"]) . " WHERE id=1") or stderr($language["ERROR"], mysql_error());
         unset($values);
         $admintpl->set("config_saved", true, true);
     }
     // we don't break, so we will display the new config...
 // we don't break, so we will display the new config...
 case 'read':
 case '':
 default:
     $admintpl->set("language", $language);
     $btit_settings = get_fresh_config("SELECT `key`,`value` FROM {$TABLE_PREFIX}settings");
     // some $btit_settings are stored in database, some other not like in template
     // we will convert and set to correct value in the array.
     if (is_array(unserialize($btit_settings["announce"]))) {
         $btit_settings["announce"] = implode("\n", unserialize($btit_settings["announce"]));
     }
     $btit_settings["external"] = $btit_settings["external"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["gzip"] = $btit_settings["gzip"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["debug"] = $btit_settings["debug"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["disable_dht"] = $btit_settings["disable_dht"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["livestat"] = $btit_settings["livestat"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["logactive"] = $btit_settings["logactive"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["loghistory"] = $btit_settings["loghistory"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["p_announce"] = $btit_settings["p_announce"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["p_scrape"] = $btit_settings["p_scrape"] == "true" ? "checked=\"checked\"" : "";
     $btit_settings["show_uploader"] = $btit_settings["show_uploader"] == "true" ? "checked=\"checked\"" : "";
         if ($key >= $first_key && $key <= $last_key) {
             $final_array[] = $value;
         }
     }
     // Output the final data
     foreach ($final_array as $value) {
         $new[$j]["line"] = $value . "\n";
         $j++;
     }
     $admintpl->set("error_logs", $new);
 } else {
     //nothing
 }
 $admintpl->set("error_log_exists", file_exists($log) ? true : false, true);
 $Match = "php_log_";
 $loglist = get_fresh_config("SELECT `key`,`value` FROM {$TABLE_PREFIX}settings where `key` LIKE '%" . $Match . "%'");
 $exp = explode("/", str_replace("\\", "/", $THIS_BASEPATH));
 $last_key = count($exp) - 1;
 unset($exp[$last_key]);
 $exp = str_replace($find, $replace, $exp);
 $recommended = implode("/", $exp) . "/xbtit-error-logs";
 $loglist["php_log_path_find"] = $recommended;
 $admintpl->set("frm_action", "index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=php_log&amp;action=save");
 $admintpl->set("config", $loglist);
 $today = date("d.m.y");
 $list = array();
 $i = 0;
 foreach (glob($btit_settings["php_log_path"] . "/" . $btit_settings["php_log_name"] . "*.log") as $logname) {
     $logname = str_replace($btit_settings["php_log_path"] . "/", "", $logname);
     if (!in($logname, $today)) {
         $list[$i]["file"] = $logname . "<br />";
     redirect("index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=invitations&action=read");
     break;
 case 'delete':
     if (isset($_GET["id"])) {
         // let's delete the invitation and send a PM to the inviter
         // just in case you want to justify the deletion
         $id = max(0, $_GET["id"]);
         // update the deleted user's style to default one
         do_sqlquery("DELETE FROM {$TABLE_PREFIX}invitations WHERE id={$id}", true);
         redirect("index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=invitations&action=read");
     }
     break;
 case '':
 case 'read':
 default:
     $btit_settings = get_fresh_config("SELECT `key`,`value` FROM {$TABLE_PREFIX}settings") or sqlerr(__FILE__, __LINE__);
     $invit["ptracker_on"] = $btit_settings['invitation_only'] ? "checked=\"checked\"" : "";
     $invit["ptracker_off"] = !$btit_settings['invitation_only'] ? "checked=\"checked\"" : "";
     $invit["reqvalid_on"] = $btit_settings['invitation_reqvalid'] ? "checked=\"checked\"" : "";
     $invit["reqvalid_off"] = !$btit_settings['invitation_reqvalid'] ? "checked=\"checked\"" : "";
     $invit["recycle_after"] = $btit_settings['invitation_expires'];
     $admintpl->set("invit", $invit);
     $admintpl->set("receiver", $_POST["receiver"]);
     $opts['name'] = 'level';
     $opts['complete'] = true;
     $opts['id'] = 'id';
     $opts['value'] = 'level';
     $opts['default'] = 0;
     $ranks = rank_list();
     $ranks[] = array('id' => 0, 'level' => $language['ALL']);
     $admintpl->set("group_combo", get_combo($ranks, $opts));