if (isset($_REQUEST['button_save'])) {
             $wfh = fopen($file, 'w');
             fwrite($wfh, $_REQUEST['config_text']);
             fclose($wfh);
             $message = "Saved to Hard Drive!";
         } elseif (isset($_REQUEST['button_save_as'])) {
             $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("' . addslashes($_REQUEST['save_as_name']) . '","' . addslashes($config_files[$_REQUEST['cfg_file']]) . '","' . $_REQUEST['product_select'] . '","' . addslashes($_REQUEST['config_text']) . '")';
             $endpoint->db->query($sql);
             $message = "Saved to Database!";
         }
     }
     $handle = fopen($file, "rb");
     $contents = fread($handle, filesize($file));
     fclose($handle);
     if (isset($_REQUEST['sendid'])) {
         $endpoint->submit_config($row['directory'], $row['cfg_dir'], $config_files[$_REQUEST['cfg_file']], $contents);
         $message = 'Sent! Thanks :-)';
     }
     $endpoint->tpl->assign("save_as_name_value", $config_files[$_REQUEST['cfg_file']]);
     $endpoint->tpl->assign("config_data", $contents);
     $endpoint->tpl->assign("filename", $config_files[$_REQUEST['cfg_file']]);
     $endpoint->tpl->assign('sendid', $_REQUEST['cfg_file']);
     $endpoint->tpl->assign("type", 'file');
     $endpoint->tpl->assign("location", $file);
 } elseif (isset($_REQUEST['sql'])) {
     if (isset($_REQUEST['config_text'])) {
         if (isset($_REQUEST['button_save'])) {
             $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($_REQUEST['config_text']) . "' WHERE id = " . $_REQUEST['sql'];
             $endpoint->db->query($sql);
             $message = "Saved to Database!";
         } elseif (isset($_REQUEST['button_save_as'])) {