<?php

    include "auth.php";

    /******************************************************
     *
     *       The following variables will be available in the settings file as defined here.
     *      Links are always relative to the root folder of the Sphider-plus installation.
     *
     */

    $thumb_folder   = "./admin/thumbs";     //  temporary folder for thumbnails during index procedure
    $thumb_dir      = "./include/thumbs";   //  temporary folder for thumbnails during search procedure
    $xml_dir        = "./xml";              //  folder for XML results
    $delim          = " _-_- ";             //  separator for original media title and transliterated words

    /******************************************************/

    //  check if RAR function is available
    if (!function_exists(rar_open) && $debug == 2) {
        echo "<br />
                <div class='cntr warnadmin sml'><br />
                <strong>Attention:</strong> Sphider-plus requires an installed RAR library as part of the PHP environment.<br />
                Indexing of RAR archives will not be available for you.<br />
                <p>&nbsp;</p>
                </div>
            ";
    }

    $gd = array ();
    $gd_lib = '1';
    if (function_exists(gd_info)) {
        $gd =gd_info();     //  get details about image functions
    }
    if (!$gd && $debug == 2) {
        echo "<br />
                <div class='cntr warnadmin sml'><br />
                Attention: Sphider-plus requires an installed GD library as part of the PHP environment.<br />
                Image search will not be available for you.<br />
                <p>&nbsp;</p>
                </div>
            ";
        $gd_lib = '0';
    }

    $_mb = "0";
    //  check if multibyte functions are available
    if (function_exists('mb_internal_encoding')) {
        if(function_exists('mb_stripos')) {
            $_mb = '1';
        }
    }

    if ($_mb != '1' && $debug == 2) {
        echo "<br />
                <div class='cntr warnadmin sml'><br />
                Attention: Sphider-plus requires an installed <strong>mb extention</strong> as part of the PHP environment.<br />
                Highlighting of search results may fail. Also the EXEL reader may fail for some characters.<br />
                mbstring is a non-default extension. This means it is not enabled by default.<br />
                You must explicitly enable the module with the PHP configure option.<br />
                See the Install section of your PHP manual for details.<br />
                <p>&nbsp;</p>
                </div>
            ";
    }

    //    find out the operating system
    if ($_op_system=="") {
        $_op_system ='lin';
        $op_system  ='lin';
    }
    $win_os ='';
    $s_soft = $_SERVER['SERVER_SOFTWARE'];
    $win_os = stripos($s_soft, "win");
    if ($win_os) {
        $_op_system = 'win';
        $op_system  = 'win';
        $catdoc_path = "..\converter\catdoc.exe";
        $catppt_path = "..\converter\catppt.exe";
    }

    //  if requested, create a .htaccess protection for admin folder
    if ($htaccess == '1') {
        if ( isset ( $_SERVER['REMOTE_ADDR'] ) ) {      //  get actual IP from admin

            $admin_ip   = htmlspecialchars($_SERVER['REMOTE_ADDR']);
            $content    = "Order deny,allow\r\nDeny from all\r\nAllow from $admin_ip";

            if (!is_file(".htaccess")) {  //  if .htaccess does not yet exist
                if ($handle = @fopen(".htaccess", "ab")) {
                    @fwrite($handle, $content);
                    @fclose($handle);

                } else {
                    echo "  <br />
                                <p class='warnadmin cntr'><br />
                                Unable to open and write the file <span class='blue'>.htaccess</span>&nbsp;in .../admin/ folder<br /><br />
                                Please chmod777 this folder in UNIX/LINUX systems.
                                <br /><br /></p>
                            ";
                }
            }
        }
    } else {   //  delete the .htaccess file to free the admin folder
        @unlink(".htaccess");
    }

    //  check PDF converter, its configuration file and try to convert a dummy document
    if ($debug == 2) {

        if ($index_pdf == 1) {
            //  check the PDF converter configuration file
            $handle = fopen ($pdf_config, "rb");
            if (!$handle) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Unable to open the configuration file <span class='blue'> .".$pdf_config." </span><br /><br />
                            for the PDF converter test procedure.
                            <br /><br /></p>
                        ";
            } else {
                $cont = fread ($handle, filesize ($pdf_config));
                fclose ($handle);
                if (!$cont) {
                    echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Unable to read the configuration file <span class='blue'> .".$pdf_config." </span><br /><br />
                            during the PDF converter test procedure.
                            <br /><br /></p>
                        ";
                }

            }

            //  manipulated configûration file?
            if(!strstr($cont, 'UTF-8')) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                            <strong>Attention:</strong> The configuration file of the PDF converter has been manipulated!<br /><br />
                            Take care of corrrect PDF document conversion.
                            <br /><br /></p>
                        ";
            }

            //      get the content of the PDF
            $handle = fopen ($pdf_dummy, "rb");
            if (!$handle) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Unable to open the file <span class='blue'> .".$pdf_dummy."</span><br /><br />
                            for the PDF converter test procedure.
                            <br /><br /></p>
                        ";
            } else {
                $contents = file_get_contents($pdf_dummy);
                fclose ($handle);
                if (!$contents) {
                    echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Unable to read the file <span class='blue'> .".$pdf_dummy."</span><br /><br />
                            during the PDF converter test procedure.
                            <br /><br /></p>
                        ";
                }

                $temp_file = "tmp_file";
                $result = array();
                $filename = $tmp_dir."/".$temp_file ;
                if (!$handle = fopen($filename, 'w')) {
                    die ("Cannot open file $filename in temp folder during PDF converter test");
                }

                if (fwrite($handle, $contents) === FALSE) {
                    die ("Cannot write to file $filename in temp folder during PDF converter test");
                }

                fclose($handle);

                if (!$handle = fopen($pdftotext_path, 'rb')) {
                    echo "<br />
                            <p class='warnadmin cntr'><br />
                            Cannot access the PDF converter. Invalid path defined.<br /><br />
                            Vain attempt to find:<br />
                            <span class='blue'>.".$pdftotext_path."</span><br /><br />
                            Please correct the path in Admin settings 'General Settings'<br />
                            and in file .../converter/pdftotext
                            <br /><br />
                            </p>
                        ";
                } else {
                    fclose($handle);
                    //  convert the dummy document
                    if ($op_system != 'win') {
                        $command = "".$pdftotext_path." -enc UTF-8 ".$filename."";
                    } else {
                        $command = "".$pdftotext_path." -cfg xpdfrc ".$filename." -";
                    }
                    $a = exec($command, $result, $retval);

                    if ($retval != '0') {  //   error handler for PDF file converter
                        if ($retval == '1' || $retval == '3' || $retval == '127') {
                            if ($retval == '1') {
                                echo "  <br />
                                        <p class='warnadmin cntr'><br />
                                        Error opening this PDF file. Perhaps because it is corrupted.<br />
                                        Unable to process this PDF document.
                                        <br /><br /></p>
                                    ";
                            }
                            if ($retval == '3') {
                                echo "  <br />
                                            <p class='warnadmin cntr'><br />
                                            Error related to PDF permissions.<br />
                                            Unable to process this PDF document.
                                            <br /><br /></p>
                                        ";
                            }
                            if ($retval == '127') {
                                echo "  <br />
                                            <p class='warnadmin cntr'><br />
                                            Could not find PDF converter.<br />
                                            Unable to process this PDF document.<br />
                                            Please follow the setup instructions as defined in the readme.pdf documentation,<br />
                                            chapter <span class='blue'>\"PDF converter for LINUX / UNIX systems\"</span>
                                            <br /><br /></p>
                                        ";
                            }
                        } else {
                            echo "  <br />
                                        <p class='warnadmin cntr'><br />
                                            Unable to process this PDF document.<br />
                                            Converter didn't pass back the ready status or any known error message.<br />
                                            Please follow the setup instructions as defined in the readme.pdf documentation,<br />
                                            chapter \"PDF converter for LINUX / UNIX systems\".
                                        <br /><br /></p>
                                    ";
                        }
                    }
                }
            }
            /*
             echo "\r\n\r\n<br /> Operating system: $op_system<br />";
             echo "\r\n\r\n<br /> PDF converter command: $command<br />";
             echo "\r\n\r\n<br /> PDF content: $result<br />";
             */
            //  dummy file correctly converted to text?
            if (!strstr($result[0], "dummy")) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                                Unable to process the PDF test document.<br />
                                Converter didn't pass back the correct content of the PDF document.<br />
                                Please follow the setup instructions as defined in the readme.pdf documentation,<br />
                                chapter \"PDF converter for LINUX / UNIX systems\".
                            <br /><br /></p>
                        ";
            }
            @unlink($filename);
        }

        if (!$handle = @fopen("../".$search_script."", 'r')) {
            echo "<br />
                    <p class='warnadmin cntr sml'><br />
                    Cannot open the search script.<br /><br />
                    Vain attempt to find: <span class='blue'>".$search_script."</span><br />
                    in root folder of the Sphider-plus installation.<br /><br />
                    Please correct 'Name of search script' in section 'General Settings'<br />
                    <br /><br />
                    </p>
                ";
        }
        @fclose("../".$search_script."");

        //      create and test thumb folder for search procedure
        if ($index_media == '1') {
            if (!is_dir(".".$thumb_dir)) {
                @mkdir(".".$thumb_dir, 0777);       //if not exist, try to create global folder for thumbnails
                if (!is_dir(".".$thumb_dir)) {
                    echo "  <br />
                                <p class='warnadmin cntr'><br />
                                Unable to create folder<span class='blue'> .".$thumb_dir."</span>.<br />
                                Sphider-plus will not be able to display thumbnails during search procedure.
                                <br /><br /></p>
                            ";
                }
            }

            $fp = @fopen(".".$thumb_dir."/".$testfile."","w");    //  try to write into a testfile
            if(!is_writeable(".".$thumb_dir."/".$testfile."")) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Folder for thumbs is not writable.<br />
                            Sphider-plus will not be able to display the thumb nails during search procedure.<br /><br />
                            chmod 777 the folder<span class='blue'> .".$thumb_dir."</span> under *nix operating systems.<br />
                            <br /><br /></p>
                        ";

            } else {
                fclose($fp);
                unlink(".".$thumb_dir."/".$testfile."");       // remove testfile
            }

            //      create and test thumb folder for media indexing
            if (!is_dir(".".$thumb_folder)) {
                @mkdir(".".$thumb_folder, 0777);        //if not exist, try to create global folder for thumbnails
                if (!is_dir(".".$thumb_folder)) {
                    echo "  <br />
                                <p class='warnadmin cntr'><br />
                                Unable to create folder<span class='blue'> .".$thumb_folder."</span>.<br />
                                Sphider-plus will not be able to display thumbnails during search procedure.
                                <br /><br /></p>
                            ";
                }
            }

            $fp = @fopen(".".$thumb_folder."/".$testfile."","w");    //  try to write into a testfile
            if(!is_writeable(".".$thumb_folder."/".$testfile."")) {
                echo "  <br />
                            <p class='warnadmin cntr'><br />
                            Folder for thumbs is not writable.<br />
                            Sphider-plus will not be able to display the thumb nails during search procedure.<br /><br />
                            chmod 777 the folder<span class='blue'> .".$thumb_folder."</span> under *nix operating systems.<br />
                            <br /><br /></p>
                        ";

            } else {
                fclose($fp);
                unlink(".".$thumb_folder."/".$testfile."");       // remove testfile
            }
        }
    }

    if ($_template == "") {
        $_template = 'Sphider-plus';
    }

    if ($_plus_nr=="") {
        $_plus_nr = $plus_nr;
    }

    if ($_version_nr == "") {
        $_version_nr = '1.3.4';
    }

    if ($_ids_warn=="") {
        $_ids_warn ='14';
    }

    if ($_ids_stop=="") {
        $_ids_stop ='25';
    }

    if ($_templ_dir == "") {
        $_templ_dir = 'templates';
    }

    if ($_tmp_dir == "") {
        $_tmp_dir = 'tmp';
    }

    if ($_search_script == "") {
        $_search_script = 'search.php';
    }

    if ($_embedded == "") {
        $_embedded = '';
    }

    if ($_case_sensitive == "") {
        $_case_sensitive = 0;
    }

    if ($_use_prefcharset == "") {
        $_use_prefcharset = 0;
    }

    if ($_home_charset == "") {
        $_home_charset = 'ISO-8859-1';
    }

    if ($_admin_email == "") {
        $_admin_email = 'admin@localhost';
    }

    if ($_dispatch_email == "") {
        $_dispatch_email = 'postmaster@abc.de';
    }

    if ($_local == "") {
        $_local = 'http://localhost/publizieren/';
    }

    if ($_user_agent =="") {
        $_user_agent = 'Sphider-plus';
    }

    if ($_browser_string =="") {
        $_browser_string = '0';
    }

    if ($_default_agent =="") {
        $_default_agent = '0';
    }

    if ($_server_char =="") {
        $_server_char = '0';
    }
    if ($_default_agent =='1') {
        $_browser_string = '0';
    }

    if ($_sites_per_page == "") {
        $_sites_per_page = 20;
    }

    if ($_sites_alpha =="") {
        $_sites_alpha = 0;
    }

    if ($_sites_latest =="") {
        $_sites_latest = 0;
    }

    if ($_sites_oldest =="") {
        $_sites_oldest = 0;
    }

    if ($_sites_title =="") {
        $_sites_title = 0;
    }

    if ($_sites_alpha == '1') {
        $_sites_latest  = '0';
        $_sites_oldest  = '0';
        $_sites_title   = '0';
    }

    if ($_sites_latest == '1') {
        $_sites_alpha   = '0';
        $_sites_oldest  = '0';
        $_sites_title   = '0';
    }

    if ($_sites_oldest == '1') {
        $_sites_latest  = '0';
        $_sites_alpha   = '0';
        $_sites_title   = '0';
    }

    if ($_sites_title == '1') {
        $_sites_latest  = '0';
        $_sites_oldest  = '0';
        $_sites_alpha   = '0';
    }


    if ($_sites_title == '0' && $_sites_latest == '0' && $_sites_oldest == '0' && $_sites_alpha == '0') {
        $_sites_alpha   = '1';
    }

    if ($_qcache == "") {
        $_qcache = 0;
    }

    if ($_not_erase == "") {
        $_not_erase = 0;
    }

    if ($_htaccess == "") {
        $_htaccess = 0;
    }

    if ($_debug == "") {
        $_debug = 0;
    }

    if ($_debug_user == "") {
        $_debug_user = 0;
    }

    if ($_keep_log == "") {
        $_keep_log = 0;
    }

    if ($_no_log == "") {
        $_no_log = 0;
    }

    if ($_language == "") {
        $_language = 'en';
    }

    if ($_follow_sitemap ==  "") {
        $_follow_sitemap = 0;
    }

    if ($_create_sitemap ==  "") {
        $_create_sitemap = 0;
    }

    if ($_domaincb == "") {
        $_domaincb = 0;
    }

    if ($_use_prefcharset == "") {
        $_use_prefcharset = 0;
    }

    if ($_depth == "") {
        $_depth = '-1';
    }

    if ($_index_numbers == "") {
        $_index_numbers = 0;
    }

    if ($_index_xls == "") {
        $_index_xls = 0;
    }

    if ($_index_csv == "") {
        $_index_csv = 0;
    }

    if ($_index_ppt == "") {
        $_index_ppt = 0;
    }

    if ($_index_pdf == "") {
        $_index_pdf = 0;
    }

    if ($_index_doc == "") {
        $_index_doc = 0;
    }

    if ($_index_rtf == "") {
        $_index_rtf = 0;
    }

    if ($_index_ods == "") {
        $_index_ods = 0;
    }

    if ($_index_odt == "") {
        $_index_odt = 0;
    }
/*
    if ($_only_docs == 1) {
        $_index_media   = 0;
        $_index_image   = 0;
        $_index_audio   = 0;
        $_index_video   = 0;
        $_show_media    = 0;
        $_search_id3    = 0;
        $_index_host    = 0;
        $_index_meta_title          = 0;
        $_index_meta_keywords       = 0;
        $_index_meta_description    = 0;
        $_show_warning  = 1;
    }
*/
    if ($_only_links == 1) {
        $_only_docs     = 0;
        $_index_media   = 0;
        $_index_image   = 0;
        $_index_audio   = 0;
        $_index_video   = 0;
        $_show_media    = 0;
        $_search_id3    = 0;
        $_index_host    = 0;
        $_index_meta_title          = 0;
        $_index_meta_keywords       = 0;
        $_index_meta_description    = 0;
        $_show_warning  = 1;
    }

    if ($_index_media == "") {
        $_index_media = 0;
    }

    if ($_index_image == "") {
        $_index_image = 0;
    }

    if ($_index_image == "1") {
        $_index_media = 1;
    }

    if ($_min_image_x == "") {
        $_min_image_x = 100;
    }

    if ($_min_image_y == "") {
        $_min_image_y = 50;
    }

    if ($_index_id3 =="") {
        $_index_id3 = 0;
    }

    if ($_dup_media =="") {
        $_dup_media = 0;
    }

    if ($_ex_media =="") {
        $_ex_media = 0;
    }

    if ($_index_audio == "") {
        $_index_audio = 0;
    }

    if ($_index_audio =="1") {
        $_index_media=1;
    }

    if ($_index_video == "") {
        $_index_video = 0;
    }

    if ($_index_video == "1") {
        $_index_media = 1;
    }

    if ($_index_embeded == "") {
        $_index_embeded = 0;
    }

    if ($_index_alt == "") {
        $_index_alt = 0;
    }


    if ($_suppress_suffix == "") {
        $_suppress_suffix = 0;
    }

    if ($_index_rss == "") {
        $_index_rss = 0;
    }

    if ($_cdata == "") {
        $_cdata = 0;
    }

    if ($_dc == "") {
        $_dc = 0;
    }

    if ($_index_rar == "") {
        $_index_rar = 0;
    }

    if ($_index_zip == "") {
        $_index_zip = 0;
    }

    if ($_index_framesets == "") {
        $_index_framesets = 0;
    }

    if ($_index_iframes == "") {
        $_index_iframes = 0;
    }

    if ($_iframe_link == "") {
        $_iframe_link = 0;
    }

    if ($_abslinks    == "") {
        $_abslinks = 0;
    }

    if ($_interval == "") {
        $_interval = 'never';
    }

    if ($_interval !="never") {
        $_multi_indexer = 1;
    }

    if ($_intv_count == "") {
        $_intv_count = '9999';
    }
    if ($_use_common == "") {
        $_use_common = 'none';
    }

    if ($_use_white1 == "") {
        $_use_white1 = 0;
    }

    if ($_use_white2 == "") {
        $_use_white2 = 0;
    }

    if ($_use_white2 == "1") {
        $_use_white1 = 0;
    }

    if ($_use_black == "") {
        $_use_black = 0;
    }

    if ($_kill_query == "") {
        $_kill_query = 0;
    }

    if ($_not_divs == "") {
        $_not_divs = 0;
    }

    if ($_use_divs == "") {
        $_use_divs = 0;
    }

    if ($_not_divs == "1") {
        $_use_divs = 0;
    }

    if ($_use_elems == "") {
        $_use_elems = 0;
    }

    if ($_not_elems == "") {
        $_not_elems = 0;
    }

    if ($_not_elems == "1") {
        $_use_elems = 0;
        $_not_divs = 0;     //  not elements has priority
    }

    if ($_use_elems == "1") {
        $_use_divs = 0;     //  use elements has priority
    }

    if ($_del_elems == "") {
        $_del_elems = 0;
    }

    if ($_conv_puny == "") {
        $_conv_puny = 0;
    }

    if ($_del_secchars == "") {
        $_del_secchars = 0;
    }

    if ($_del_seccharin == "") {
        $_del_seccharin = 0;
    }

    if ($_quotes == "") {
        $_quotes = 0;
    }

    if ($_dup_quotes == "") {
        $_dup_quotes = 0;
    }

    if ($_vowels == "") {
        $_vowels = 0;
    }

    if ($_mytitle == "") {
        $_mytitle = "Sphider-plus";
    }

    if ($_smap_dir == "") {
        $_smap_dir = "sitemaps";
    }

    if ($_multi_indexer < "1") {
        $_multi_indexer = 1;
    }

    if ($_multi_indexer > "10") {
        $_multi_indexer = 10;
    }

    if ($_multi_indexer > "1") {
        $_keep_log  = 1;
        $_no_log    = 1;
        $_real_log  = 0;
        $_index_pdf = 0;    //  as long as we are obliged to use the 'executable' converter
        $_index_doc = 0;
        $_index_rtf = 0;
        $_index_ppt = 0;
        $_interval  = "never";
    }

    if ($_smap_unique == "") {
        $_smap_unique = 0;
    }

    if ($_utf_16 == "") {
        $_utf_16 = 0;
    }

    if ($_max_links == "") {
        $_max_links = "9999";
    }

    if ($_interrupt == "") {
        $_interrupt = "&nbsp;&nbsp;--";
    }


    if ($_interrupt < "1" || $_interrupt > "9999") {
        $_interrupt = "&nbsp;&nbsp;--";
    }

    if ($_min_delay == "") {
        $_min_delay = 0 ;
    }

    if ($_index_host == "") {
        $_index_host = 0;
    }

    if ($_keep_log  == "") {
        $_keep_log = 0;
    }

    if ($_show_meta_description == "") {
        $_show_meta_description = 0;
    }

    if ($_show_warning == "") {
        $_show_warning = 0;
    }

    if ($_show_categories == "") {
        $_show_categories = 0;
    }

    if ($_more_catres == "") {
        $_more_catres = 0;
    }

    if ($_more_catres == "1") {
        $_show_categories = 1;
    }

    if ($_title_length == "") {
        $_title_length = 80;
    }

    if ($_url_length == "") {
        $_url_length = 80;
    }

    if ($_min_words_per_page == "") {
        $_min_words_per_page = 5;
    }

    if ($_min_word_length == "") {
        $_min_word_length = '3';
    }

    if ($_word_upper_bound == "") {
        $_word_upper_bound = '100';
    }
    if ($_max_hits == "") {
        $_max_hits = 1;
    }

    if ($_show_res_num == "") {
        $_show_res_num = 0;
    }

    if ($_show_query_scores == "") {
        $_show_query_scores = 0;
    }

    if ($_show_res_url == "") {
        $_show_res_url = 0;
    }

    if ($_show_res_url == "0") {
        $_show_query_scores = 0;
    }

    if ($_no_quotes == "") {
        $_no_quotes = 0;
    }

    if ($_wild_num == "") {
        $_wild_num = 0;
    }

    if ($_results_per_page == "") {
        $_results_per_page = 10;
    }

    if ($_bound_search_result == "") {
        $_bound_search_result = 0;
    }

    if ($_text_length == "") {
        $_text_length = 0;
    }

    if ($_links_to_next == "") {
        $_links_to_next = 9;
    }

    if ($_elapsed == "") {
        $_elapsed = 0;
    }

    if ($_desc_length == "") {
        $_desc_length = 250;
    }

    if ($_suggest_keywords == "") {
        $_suggest_keywords = 0;
    }

    if ($_title_weight == "") {
        $_title_weight = 20;
    }

    if ($_domain_weight == "") {
        $_domain_weight = 60;
    }

    if ($_path_weight == "") {
        $_path_weight = 10;
    }

    if ($_meta_weight == "") {
        $_meta_weight = 5;
    }

    if ($_email_log == "") {
        $_email_log = 0 ;
    }

    if ($_no_log == "") {
        $_no_log = 0;
    }

    if ($_keep_log == "") {
        $_keep_log = 0;
    }

    if ($_log_dir == "") {
        $_log_dir = 'log';
    }

    if ($_real_log == "") {
        $_real_log = 0;
    }

    if ($_real_log == "1") {
        $_keep_log = 1;
        $_log_format = "html";
    }

    if ($_refresh == "") {
        $_refresh = 3;
    }

    if ($_click_wait == "") {
        $_click_wait = 60;
    }

    if ($_sort_user == "") {
        $_sort_user = '0';
    }

    //  define default image sizes
    if ($_grid_pimage_x == "") {
        $_grid_pimage_x = '100';
    }

    if ($_grid_pimage_y == "") {
        $_grid_pimage_y = '100';
    }

    if ($_list_pimage_x == "") {
        $_list_pimage_x = '50';
    }

    if ($_list_pimage_y == "") {
        $_list_pimage_y = '50';
    }

    if ($_list_bimage_x == "") {
        $_list_bimage_x = '50';
    }

    if ($_list_bimage_y == "") {
        $_list_bimage_y = '50';
    }

    //  ensure maximum image size
    if ($_grid_pimage_x > $prd_img_grid_max) {
        $_grid_pimage_x = $prd_img_grid_max;
    }

    if ($_grid_pimage_y > $prd_img_grid_max) {
        $_grid_pimage_y = $prd_img_grid_max;
    }

    if ($_list_pimage_x > $prd_img_list_max) {
        $_list_pimage_x = $prd_img_list_max;
    }

    if ($_list_pimage_y > $prd_img_list_max) {
        $_list_pimage_y = $prd_img_list_max;
    }

    if ($_list_bimage_x > $brd_img_list_max) {
        $_list_bimage_x = $brd_img_list_max;
    }

    if ($_list_bimage_y > $brd_img_list_max) {
        $_list_bimage_y = $brd_img_list_max;
    }

    //  ensure minimum image size
    if ($_grid_pimage_x < $prd_img_grid_min) {
        $_grid_pimage_x = $prd_img_grid_min;
    }

    if ($_grid_pimage_y < $prd_img_grid_min) {
        $_grid_pimage_y = $prd_img_grid_min;
    }

    if ($_list_pimage_x < $prd_img_list_min) {
        $_list_pimage_x = $prd_img_list_min;
    }

    if ($_list_pimage_y < $prd_img_list_min) {
        $_list_pimage_y = $prd_img_list_min;
    }

    if ($_list_bimage_x < $brd_img_list_min) {
        $_list_bimage_x = $brd_img_list_min;
    }

    if ($_list_bimage_y < $brd_img_list_min) {
        $_list_bimage_y = $brd_img_list_min;
    }

    if ($_idna == "") {
        $_idna = 0;
    }

    if ($_show_url == "") {
        $_show_url = 0;
    }

    if ($_clear == "") {
        $_clear = 0;
    }

    if ($_clear_query == "") {
        $_clear_query = 0;
    }

    if ($_auto_add == "") {
        $_auto_add = 0;
    }

    if ($_del_related == "") {
        $_del_related = 0;
    }
    if ($_use_ids == "") {
        $_use_ids = 0;
    }

    if ($_ids_blocked == "") {
        $_ids_blocked = 0;
    }

    if ($_index_meta_title == "") {
        $_index_meta_title = 0;
    }

    if ($_index_meta_keywords == "") {
        $_index_meta_keywords = 0;
    }

    if ($_index_meta_description == "") {
        $_index_meta_description = 0;
    }

    if ($_index_host == "") {
        $_index_host = 0;
    }

    if ($_ignore_fulltxt == "") {
        $_ignore_fulltxt = 0;
    }

    if ($_ignore_fulltxt== 1 && $_only_links != 1) {
        $_only_docs     = 0;
        $_index_meta_title          = 1;
        $_index_meta_keywords       = 1;
        $_index_meta_description    = 1;
        $_not_divs      = 0;
        $_use_divs      = 0;
        $_not_elems     = 0;
        $_use_elems     = 0;
        $_index_image   = 0;
        $_index_audio   = 0;
        $_index_video   = 0;
    }

    if ($_advanced_search == "") {
        $_advanced_search = 0;
    }

    if ($_sort_results == "") {
        $_sort_results = 0;
    }

    if ($_dompromo == "") {
        $_dompromo = '';
    }

    if ($_keypromo == "") {
        $_keypromo = '';
    }

    if ($_dom_count == "") {
        $_dom_count = '';
    }

    if ($_domain_mul == "") {
        $_domain_mul = 1;
    }

    if ($_show_sort == "") {
        $_show_sort = 0;
    }

    if ($_show_media == "") {
        $_show_media = 0;
    }

    if ($_limit_media == "") {
        $_limit_media = 999;
    }

    if ($_index_id3 == "0") {   //  if not indexed
        $_search_id3 = 0;
    }

    if ($_search_id3 == "") {
        $_search_id3 = 0;
    }

    if ($_sort_media == "") {
        $_sort_media = 1;
    }

    if ($_most_pop == "") {
        $_most_pop = 0;
    }

    if ($_no_zeros == "") {
        $_no_zeros = 0;
    }

    if ($_tag_cloud == "") {
        $_tag_cloud = 0;
    }

    if ($_color_cloud == "") {
        $_color_cloud = 0;
    }

    if ($_pop_rows == "") {
        $_pop_rows = 0;
    }

    if ($_pop_rows > "20") {
        $_pop_rows = 20;
    }


    if ($_relevance == "") {
        $_relevance = 0;
    }

    if ($_max_results == "") {
        $_max_results = 9999;
    }

    if ($_db_content == "") {
        $_db_content = 0;
    }

    if ($_add_url == "") {
        $_add_url = 0;
    }

    if ($_addurl_info == "") {
        $_addurl_info = 0;
    }

    if ($_add_auth == "") {
        $_add_auth = 0;
    }

    if ($_whois_admin == "") {
        $_whois_admin = 0;
    }

    if ($_whois_user == "") {
        $_whois_user = 0;
    }

    if ($_whois_ext == "") {
        $_whois_ext = 0;
    }

    if ($_captcha == "") {
        $_captcha = 0;
    }

    if ($_did_you_mean_enabled == "") {
        $_did_you_mean_enabled = 0;
    }

    if ($_stem_words == "") {
        $_stem_words = 'none';
    }

    //  Chinese segmenter is also used for stemming
    if ($_stem_words == 'cn') {
        $_cn_seg = "1";
    }

    if ($_cn_seg == "1" || $_jp_seg == "1" || $_use_common == 'cn' || $_use_common == 'ar' || $_use_common == 'ru') {
        $_case_sensitive = 1;
    }

    //  if stemming is enabled, activate also
    //  the corresponding common.txt file as stop-words
    if ($_stem_words == 'bg') {
        $_use_common = 'bg';
    }

    if ($_stem_words == 'cz') {
        $_use_common = 'cz';
    }

    if ($_stem_words == 'de') {
        $_use_common = 'de';
    }

    if ($_stem_words == 'el') {
        $_use_common = 'el';
        $_greek = '1';
    }

    if ($_stem_words == 'en') {
        $_use_common = 'en';
    }

    if ($_stem_words == 'es') {
        $_use_common = 'es';
    }

    if ($_stem_words == 'fr') {
        $_use_common = 'fr';
    }

    if ($_stem_words == 'fi') {
        $_use_common = 'fi';
    }

    if ($_stem_words == 'hu') {
        $_use_common = 'hu';
    }

    if ($_stem_words == 'nl') {
        $_use_common = 'nl';
    }

    if ($_stem_words == 'it') {
        $_use_common = 'it';
    }

    if ($_stem_words == 'pt') {
        $_use_common = 'pt';
    }
    if ($_stem_words == 'ru') {
        $_use_common = 'ru';
        $_cyrillic = '1';
    }

    if ($_stem_words == 'se') {
        $_use_common = 'se';
    }

    if ($_strip_sessids == "") {
        $_strip_sessids = 0;
    }

    if ($_strip_s_sessids == "") {
        $_strip_s_sessids = 0;
    }

    if ($_other_host == "") {
        $_other_host = 0;
    }

    if ($_redir_host == "") {
        $_redir_host = 0;
    }

    if ($_redir_host == "1") {  //  either...or
        $_other_host = 0;
    }

    if ($_cano_leave == "") {
        $_cano_leave = 0;
    }

    if ($_cano_leave == "1") {  //  either...or
        $_domaincb = 0;
    }

    if ($_js_reloc == "") {
        $_js_reloc = 0;
    }

    if ($_dup_path == "") {
        $_dup_path = 0;
    }

    if ($_only_docs == "") {
        $_only_docs = 0;
    }

    if ($_only_links == "") {
        $_only_links = 0;
    }

    if ($_link_check == "") {
        $_link_check = 0;
    }

    if ($_dup_content == "") {
        $_dup_content = 0;
    }

    if ($_div_all == "") {
        $_div_all = 0;
    }

    if ($_div_hyphen == "") {
        $_div_hyphen = 0;
    }

    if ($_div_hyphen == "1") {
        $_div_all = 0;
    }

    if ($_bb_decode == "") {
        $_bb_decode = "0";
    }

    if ($_ent_decode == "") {
        $_ent_decode = "0";
    }

    if ($_greek == "") {
        $_greek = "0";
    }

    if ($_translit_el == "" || $_mb != "1") {
        $_translit_el = "0";
    }

    if ($_noacc_el == "" || $_mb != "1") {
        $_noacc_el = "0";
    }

    if ($_translit_el == "1" || $_noacc_el == "1" || $_noacc_res == "1") {
        $_greek = "1";  //  required for correct indexing
    }

    if ($_cyrillic == "") {
        $_cyrillic = "0";
    }

    if ($_cn_seg == "") {
        $_cn_seg = "0";
    }

    if ($_jp_seg == "") {
        $_jp_seg = "0";
    }

    if ($_user1 == "") {
        $_user1 = "0";
    }

    if ($_user2 == "") {
        $_user2 = "0";
    }

    if ($_user3 == "") {
        $_user3 = "0";
    }

    if ($_pwd1 == "") {
        $_pwd1 = "0";
    }

    if ($_pwd2 == "") {
        $_pwd2 = "0";
    }

    if ($_pwd3 == "") {
        $_pwd3 = "0";
    }

    if ($_auto_lng == "") {
        $_auto_lng = 0;
    }

    if ($_kill_black_uas == "") {
        $_kill_black_uas = 0;
    }

    if ($_kill_black_ips == "") {
        $_kill_black_ips = 0;
    }

    if ($_block_attacks == "") {
        $_block_attacks = 0;
    }

    if ($_use_cache == "") {
        $_use_cache = 0;
    }

    if ($_tcache_size == "") {
        $_tcache_size = 1;
    }

    if ($_tcache_size < '1') {
        $_tcache_size = 1;
    }
    if ($_mcache_size == "") {
        $_mcache_size = 1;
    }

    if ($_mcache_size < '1') {
        $_mcache_size = 1;
    }

    if ($_max_ctresults == "") {
        $_max_ctresults = '9999';
    }

    if ($_max_cmresults == "") {
        $_max_cmresults = '9999';
    }
    if ($_clear_cache == "") {
        $_clear_cache = 0;
    }

    if ($_min_sug_chars == "") {
        $_min_sug_chars = 0;
    }

    if ($_suggest_history == "") {
        $_suggest_history  = 0;
    }

    if ($_suggest_phrases == "") {
        $_suggest_keywords = 0;
    }

    if ($_suggest_phrases == "") {
        $_suggest_phrases = 0;
    }

    if ($_suggest_id3 == "") {
        $_suggest_id3 = 0;
    }

    if ($_show_hits == "") {
        $_show_hits = 0;
    }

    if ($_suggest_rows == "") {
        $_suggest_rows = 20;
    }

    if ($_database == "") {
        $_database = 'sphider';
    }

    if ($_mysql_user == "") {
        $_mysql_user = 'root';
    }

    if ($_mysql_password == "") {
        $_mysql_password = 'admin';
    }

    if ($_mysql_host  == "") {
        $_mysql_host  = 'localhost';
    }

    if ($_db_num == "") {
        $_db_num = 1;
    }

    if (isset($Submit)) {

        //  get PHP info
        $phpinfo ='';
        ob_start();                     // redirect output into buffer
        phpinfo();
        $phpinfo = ob_get_contents();   // get all from phpinfo
        ob_end_clean();                 // clean buffer and close it
        //  extract the table content
        $start  = stripos($phpinfo, "<table ");
        $end    = strripos($phpinfo, "</table>")+8;
        $length = $end - $start;
        $phpinfo = substr($phpinfo, $start, $length);

        //  cURL library is available?
        $curl = '0';
        $curl_info = substr($phpinfo, stripos($phpinfo, "cURL support"), "60");
        if (stripos($curl_info, "enabled")) {
            $curl = '1';
        }

        $fp = @fopen("".$settings_dir."/db".$dba_act."/".$testfile."","w");    //  try to write into a testfile
        if (!is_writable("".$settings_dir."/db".$dba_act."/".$testfile."")) {
            print "Configuration file is not writable, chmod 777 all subfolder and files  .../settings/ under *nix operating systems";
        } else {
            fclose($fp);
            unlink("".$settings_dir."/db".$dba_act."/".$testfile."");       // remove testfile

            if ($real_log=="1") {
                $truncate = mysql_query ("TRUNCATE `".$mysql_table_prefix."real_log`");     //  reset the real_log table

                if ($_refresh < '1') {
                    $_refresh = '1';     //  life belt for invalid admin input
                }
                if ($_refresh > '10') {
                    $_refresh = '10';     //  life belt for invalid admin input
                }
                $update = mysql_query("insert into ".$mysql_table_prefix."real_log set url='' , refresh=$_refresh ");
                if ($debug > '0') echo mysql_error();
            }

            $fhandle=fopen("".$settings_dir."/db".$dba_act."/conf_".$mysql_table_prefix.".php","wb");
            fwrite($fhandle,"<?php \n");

            fwrite($fhandle,"/************************************************\n ");
            fwrite($fhandle,"Sphider-plus version $_plus_nr configuration file.\n");
            fwrite($fhandle,"\n > > >  DO NOT EDIT THIS FILE. < < < \n\n");
            fwrite($fhandle,"Any modification must be done by Admin settings. \n");
            fwrite($fhandle,"*************************************************/");

            fwrite($fhandle,"\n\n\n\n\n/******************************* Check for forbidden direct access ************************************/\n\n");
            fwrite($fhandle,"    if (!defined('_SECURE')) die (\"No direct access to configuration file\");");

            fwrite($fhandle,"\n\n\n\n/*********************** \nGeneral settings \n***********************/");
            fwrite($fhandle, "\n\n// Sphider-plus version \n");
            fwrite($fhandle,"$"."plus_nr = '".$_plus_nr. "';");
            fwrite($fhandle, "\n\n// Original Sphider version \n");
            fwrite($fhandle,"$"."version_nr = '".$_version_nr. "';");
            fwrite($fhandle, "\n\n// IDS impact warn level\n");
            fwrite($fhandle,"$"."ids_warn = '".$_ids_warn. "';");
            fwrite($fhandle, "\n\n// IDS impact stop traffic level\n");
            fwrite($fhandle,"$"."ids_stop = '".$_ids_stop. "';");
            fwrite($fhandle, "\n\n//Standard charset of your location (e.g. ISO-8859-1)\n");
            fwrite($fhandle,"$"."home_charset = '".$_home_charset. "';");
            fwrite($fhandle, "\n\n//Administrators email address (logs and info emails will be sent there)\n");
            fwrite($fhandle,"$"."admin_email = '".$_admin_email. "';");
            fwrite($fhandle, "\n\n//Dispatcher email address (info emails will be sent from this account)\n");
            fwrite($fhandle,"$"."dispatch_email = '".$_dispatch_email. "';");
            fwrite($fhandle, "\n\n//Address to localhost document root \n");
            fwrite($fhandle,"$"."local = '".$_local. "';");
            fwrite($fhandle, "\n\n//Folder for thumbnails during search procedure \n");
            fwrite($fhandle,"$"."thumb_dir = '".$thumb_dir. "';");
            fwrite($fhandle, "\n\n//Folder for thumbnails during index procedure \n");
            fwrite($fhandle,"$"."thumb_folder = '".$thumb_folder. "';");
            fwrite($fhandle, "\n\n//Folder for XML results \n");
            fwrite($fhandle,"$"."xml_dir = '".$xml_dir. "';");
            fwrite($fhandle, "\n\n//Delimiter to separate real tile and transliterated part of media titles \n");
            fwrite($fhandle,"$"."delim = '".$delim. "';");
            fwrite($fhandle, "\n\n// Accept non-ASCII URLS to be added\n");
            fwrite($fhandle,"$"."idna = ".$_idna. ";");
            fwrite($fhandle, "\n\n// Show complete list of URLs during import and export\n");
            fwrite($fhandle,"$"."show_url = ".$_show_url. ";");
            fwrite($fhandle, "\n\n// Default for number of sites per page in Admin backend\n");
            fwrite($fhandle,"$"."sites_per_page = ".$_sites_per_page. ";");
            fwrite($fhandle, "\n\n// Sort Sites table in Admin section in alphabetic order\n");
            fwrite($fhandle,"$"."sites_alpha = ".$_sites_alpha. ";");
            fwrite($fhandle, "\n\n// Sort Sites table in Admin section by indexdate, latest on top\n");
            fwrite($fhandle,"$"."sites_latest = ".$_sites_latest. ";");
            fwrite($fhandle, "\n\n// Sort Sites table in Admin section by indexdate, oldest on top\n");
            fwrite($fhandle,"$"."sites_oldest = ".$_sites_oldest. ";");
            fwrite($fhandle, "\n\n// Sort Sites table in Admin section by title\n");
            fwrite($fhandle,"$"."sites_title = ".$_sites_title. ";");
            fwrite($fhandle, "\n\n//  MySQL query cache\n");
            fwrite($fhandle,"$"."qcache = ".$_qcache. ";");
            fwrite($fhandle, "\n\n//  Don't erase URLs containing 'Must Not include' words\n");
            fwrite($fhandle,"$"."not_erase = ".$_not_erase. ";");
            fwrite($fhandle, "\n\n//  .htaccess protection for admin folder\n");
            fwrite($fhandle,"$"."htaccess = ".$_htaccess. ";");
            fwrite($fhandle, "\n\n// Admin debug mode - Show details from index / re-index procedure, MySQL and PHP error messages\n");
            fwrite($fhandle,"$"."debug = ".$_debug. ";");
            fwrite($fhandle, "\n\n// User debug mode - Show details concerning database and cache activity\n");
            fwrite($fhandle,"$"."debug_user = ".$_debug_user. ";");
            fwrite($fhandle, "\n\n// Use 'Intrusion Detection System'\n");
            fwrite($fhandle,"$"."use_ids = ".$_use_ids. ";");
            fwrite($fhandle, "\n\n// Block Internet traffic of IP's detected by 'Intrusion Detection System'\n");
            fwrite($fhandle,"$"."ids_blocked = ".$_ids_blocked. ";");
            fwrite($fhandle, "\n\n// Free resources when indexing large amount of URLs \n");
            fwrite($fhandle,"$"."clear = ".$_clear. ";");
            fwrite($fhandle, "\n\n// Reset query log during erase and index procedures \n");
            fwrite($fhandle,"$"."clear_query = ".$_clear_query. ";");
            fwrite($fhandle, "\n\n// Remember new domains found during index procedure \n");
            fwrite($fhandle,"$"."auto_add = ".$_auto_add. ";");
            fwrite($fhandle, "\n\n// Delete related keywords and links after site delete \n");
            fwrite($fhandle,"$"."del_related = ".$_del_related. ";");
            fwrite($fhandle, "\n\n// Template directory\n");
            fwrite($fhandle,"$"."templ_dir = '".$_templ_dir. "';");
            fwrite($fhandle, "\n\n// Temporary directory, this should be readable and writable\n");
            fwrite($fhandle,"$"."tmp_dir = '".$_tmp_dir. "';");
            fwrite($fhandle, "\n\n// Name of search script\n");
            fwrite($fhandle,"$"."search_script = '".$_search_script. "';");
            fwrite($fhandle, "\n\n// Embedded application of Sphider-plus HTML code \n");
            fwrite($fhandle,"$"."embedded = '".$_embedded. "';");
            fwrite($fhandle, "\n\n// Operating System\n");
            fwrite($fhandle,"$"."op_system = '".$_op_system. "';");
            fwrite($fhandle, "\n\n// Availability of cURL library \n");
            fwrite($fhandle,"$"."curl = '".$curl. "';");
            fwrite($fhandle,"\n\n\n/*********************** \nLogging settings \n***********************/");
            fwrite($fhandle, "\n\n//  Disable output of logging data during index / re-index \n");
            fwrite($fhandle,"$"."no_log = ".$_no_log. ";");
            fwrite($fhandle, "\n\n//  Enable real-time output of logging data \n");
            fwrite($fhandle,"$"."real_log = ".$_real_log. ";");
            fwrite($fhandle, "\n\n//  Interval for real-time Log file update [seconds]\n");
            fwrite($fhandle,"$"."refresh = ".$_refresh. ";");
            fwrite($fhandle, "\n\n//  Interval until next click will be accepted to increase popularity of a link [seconds]\n");
            fwrite($fhandle,"$"."click_wait = ".$_click_wait. ";");
            fwrite($fhandle, "\n\n// Should log files be kept\n");
            fwrite($fhandle,"$"."keep_log = ".$_keep_log. ";");
            fwrite($fhandle, "\n\n//Log directory, this should be readable and writable\n");
            fwrite($fhandle,"$"."log_dir = '".$_log_dir. "';");
            fwrite($fhandle, "\n\n// Log format\n");
            fwrite($fhandle,"$"."log_format = '".$_log_format. "';");
            fwrite($fhandle, "\n\n//  Send log file by email \n");
            fwrite($fhandle,"$"."email_log = ".$_email_log. ";");

            fwrite($fhandle,"\n\n\n/*********************** \nSpider settings \n***********************/");
            fwrite($fhandle, "\n\n// Separate between upper- and lower-case queries\n");
            fwrite($fhandle,"$"."case_sensitive   = ".$_case_sensitive. ";");
            fwrite($fhandle, "\n\n// Sitemap directory, this should be readable and writable \n");
            fwrite($fhandle,"$"."smap_dir = '".$_smap_dir. "';");
            fwrite($fhandle, "\n\n// Count of threads for indexing \n");
            fwrite($fhandle,"$"."multi_indexer = '".$_multi_indexer. "';");
            fwrite($fhandle, "\n\n// Max. links to be followed per site \n");
            fwrite($fhandle,"$"."max_links = '".$_max_links. "';");
            fwrite($fhandle, "\n\n// Interrupt indexer each x links \n");
            fwrite($fhandle,"$"."interrupt = '".$_interrupt. "';");
            fwrite($fhandle, "\n\n// Min words per page required for indexing \n");
            fwrite($fhandle,"$"."min_words_per_page = ".$_min_words_per_page. ";");
            fwrite($fhandle, "\n\n// Words shorter than this will not be indexed\n");
            fwrite($fhandle,"$"."min_word_length = ".$_min_word_length. ";");
            fwrite($fhandle, "\n\n// Keyword weight depending on the number of times it appears in a page is capped at this value\n");
            fwrite($fhandle,"$"."word_upper_bound = ".$_word_upper_bound. ";");
            fwrite($fhandle,"\n\n// The length of full text, indexed at each page [0=unlimeted]. \n");
            fwrite($fhandle,"$"."text_length = ".$_text_length. ";");
            fwrite($fhandle, "\n\n// If available follow 'sitemap.xml'\n");
            fwrite($fhandle,"$"."follow_sitemap		= ".$_follow_sitemap. ";");
            fwrite($fhandle, "\n\n// Create sitemap.xml file of each indexed site\n");
            fwrite($fhandle,"$"."create_sitemap		= ".$_create_sitemap. ";");
            fwrite($fhandle, "\n\n// Sitemap name unique for all .xml files \n");
            fwrite($fhandle,"$"."smap_unique = '".$_smap_unique. "';");
            fwrite($fhandle, "\n\n// Convert UTF-16 coded sites into UTF-8 \n");
            fwrite($fhandle,"$"."utf_16 = '".$_utf_16. "';");
            fwrite($fhandle, "\n\n// Crawler can leave domain during indexing\n");
            fwrite($fhandle,"$"."domaincb = ".$_domaincb. ";");
            fwrite($fhandle, "\n\n// Use preferred charset for indexing\n");
            fwrite($fhandle,"$"."use_prefcharset = ".$_use_prefcharset. ";");
            fwrite($fhandle, "\n\n// Indexing depth\n");
            fwrite($fhandle,"$"."depth = ".$_depth. ";");
            fwrite($fhandle, "\n\n// Index numbers as well\n");
            fwrite($fhandle,"$"."index_numbers = ".$_index_numbers. ";");
            fwrite($fhandle,"\n\n// if this value is set to 1, word in domain name and url path are also indexed,\n// so that for example the index of www.php.net returns a positive answer to query 'php' even\n// if the word is not included in the page itself.\n");
            fwrite($fhandle,"$"."index_host = ".$_index_host.";\n");
            fwrite($fhandle, "\n\n// Whether to index the Meta tag: Title\n");
            fwrite($fhandle,"$"."index_meta_title = ".$_index_meta_title. ";");
            fwrite($fhandle, "\n\n// Whether to index the Meta tag: Keywords\n");
            fwrite($fhandle,"$"."index_meta_keywords = ".$_index_meta_keywords. ";");
            fwrite($fhandle, "\n\n// Whether to index the Meta tag: Description\n");
            fwrite($fhandle,"$"."index_meta_description = ".$_index_meta_description. ";");
            fwrite($fhandle, "\n\n// Do not index the full text\n");
            fwrite($fhandle,"$"."ignore_fulltxt = ".$_ignore_fulltxt. ";");
            fwrite($fhandle, "\n\n// Index PDF files\n");
            fwrite($fhandle,"$"."index_pdf = ".$_index_pdf. ";");
            fwrite($fhandle, "\n\n// Index DOC files\n");
            fwrite($fhandle,"$"."index_doc = ".$_index_doc. ";");
            fwrite($fhandle, "\n\n// Index RTF files\n");
            fwrite($fhandle,"$"."index_rtf = ".$_index_rtf. ";");
            fwrite($fhandle, "\n\n// Index XLS files\n");
            fwrite($fhandle,"$"."index_xls = ".$_index_xls. ";");
            fwrite($fhandle, "\n\n// Index CSV files\n");
            fwrite($fhandle,"$"."index_csv = ".$_index_csv. ";");
            fwrite($fhandle, "\n\n// Index PPT files\n");
            fwrite($fhandle,"$"."index_ppt = ".$_index_ppt. ";");
            fwrite($fhandle, "\n\n// Index ODS files\n");
            fwrite($fhandle,"$"."index_ods = ".$_index_ods. ";");
            fwrite($fhandle, "\n\n// Index ODT files\n");
            fwrite($fhandle,"$"."index_odt = ".$_index_odt. ";");
            fwrite($fhandle, "\n\n//Path to PDF converter\n");
            fwrite($fhandle,"$"."pdftotext_path = '".$_pdftotext_path. "';");
            fwrite($fhandle, "\n\n//Path to DOC converter\n");
            fwrite($fhandle,"$"."catdoc_path = '".$catdoc_path. "';");
            fwrite($fhandle, "\n\n//Path to PPT converter\n");
            fwrite($fhandle,"$"."catppt_path = '".$catppt_path. "';");
            fwrite($fhandle, "\n\n//Multibyte extention of PHP\n");
            fwrite($fhandle,"$"."mb = '".$_mb. "';");
            fwrite($fhandle, "\n\n// Index media files (general selection)\n");
            fwrite($fhandle,"$"."index_media = '".$_index_media. "';");
            fwrite($fhandle, "\n\n// Index image files \n");
            fwrite($fhandle,"$"."index_image = '".$_index_image. "';");
            fwrite($fhandle, "\n\n// Minimum size for image files (width)\n");
            $_min_image_x = substr(intval($_min_image_x),'0', '5' );
            fwrite($fhandle,"$"."min_image_x = '".$_min_image_x. "';");
            fwrite($fhandle, "\n\n// Minimum size for image files (height)\n");
            $_min_image_y = substr(intval($_min_image_y),'0', '5' );
            fwrite($fhandle,"$"."min_image_y = '".$_min_image_y. "';");
            fwrite($fhandle, "\n\n// Index audio files \n");
            fwrite($fhandle,"$"."index_audio = '".$_index_audio. "';");
            fwrite($fhandle, "\n\n// Index video files \n");
            fwrite($fhandle,"$"."index_video = '".$_index_video. "';");
            fwrite($fhandle, "\n\n// Index embeded media files \n");
            fwrite($fhandle,"$"."index_embeded = '".$_index_embeded. "';");
            fwrite($fhandle, "\n\n// Index alt tag of images \n");
            fwrite($fhandle,"$"."index_alt = '".$_index_alt. "';");
            fwrite($fhandle, "\n\n// Suppress file suffix from image names \n");
            fwrite($fhandle,"$"."suppress_suffix = '".$_suppress_suffix. "';");
            fwrite($fhandle, "\n\n// Index ID3 tags \n");
            fwrite($fhandle,"$"."index_id3 = '".$_index_id3. "';");
            fwrite($fhandle, "\n\n// Index duplicate media on different pages \n");
            fwrite($fhandle,"$"."dup_media = '".$_dup_media. "';");
            fwrite($fhandle, "\n\n// Index external hosted media content \n");
            fwrite($fhandle,"$"."ex_media = '".$_ex_media. "';");
            fwrite($fhandle, "\n\n// Index RSS and Atom feeds \n");
            fwrite($fhandle,"$"."index_rss = '".$_index_rss. "';");
            fwrite($fhandle, "\n\n// Follow CDATA tags in feeds \n");
            fwrite($fhandle,"$"."cdata = '".$_cdata. "';");
            fwrite($fhandle, "\n\n// Index Dublin Core tags in RDF feeds \n");
            fwrite($fhandle,"$"."dc = '".$_dc. "';");
            fwrite($fhandle, "\n\n// Follow PREFERRED directive in RSD feeds \n");
            fwrite($fhandle,"$"."preferred = '".$_preferred. "';");
            fwrite($fhandle, "\n\n// Index RAR files and archives \n");
            fwrite($fhandle,"$"."index_rar = '".$_index_rar. "';");
            fwrite($fhandle, "\n\n// Index ZIP files and archives \n");
            fwrite($fhandle,"$"."index_zip = '".$_index_zip. "';");
            fwrite($fhandle, "\n\n// Index framesets \n");
            fwrite($fhandle,"$"."index_framesets = '".$_index_framesets. "';");
            fwrite($fhandle, "\n\n// Index iframes \n");
            fwrite($fhandle,"$"."index_iframes = '".$_index_iframes. "';");
            fwrite($fhandle, "\n\n// Jump to iframe directly \n");
            fwrite($fhandle,"$"."iframe_link = '".$_iframe_link. "';");
            fwrite($fhandle, "\n\n// Index media conent with respect toframe/iframe position \n");
            fwrite($fhandle,"$"."abslinks = '".$_abslinks. "';");
            fwrite($fhandle, "\n\n// Time interval for auto re-index \n");
            fwrite($fhandle,"$"."interval = '".$_interval. "';");
            fwrite($fhandle, "\n\n// Auto re-index counter \n");
            fwrite($fhandle,"$"."intv_count = '".$_intv_count. "';");
            fwrite($fhandle, "\n\n// Language of 'common word' list \n");
            fwrite($fhandle,"$"."use_common = '".$_use_common. "';");
            fwrite($fhandle, "\n\n// Use any word in whitelist to enable page indexing\n");
            fwrite($fhandle,"$"."use_white1 = '".$_use_white1. "';");
            fwrite($fhandle, "\n\n// Use all words of whitelist to enable page indexing\n");
            fwrite($fhandle,"$"."use_white2 = '".$_use_white2. "';");
            fwrite($fhandle, "\n\n// Use blacklist to prevent page indexing\n");
            fwrite($fhandle,"$"."use_black = '".$_use_black. "';");
            fwrite($fhandle, "\n\n// Use blacklist to delete query input\n");
            fwrite($fhandle,"$"."kill_query = '".$_kill_query. "';");
            fwrite($fhandle, "\n\n// Use div-list to ignore some divs\n");
            fwrite($fhandle,"$"."not_divs = '".$_not_divs. "';");
            fwrite($fhandle, "\n\n// Use div-list to index only div content\n");
            fwrite($fhandle,"$"."use_divs = '".$_use_divs. "';");
            fwrite($fhandle, "\n\n// Use element-list to ignore some HTML elements\n");
            fwrite($fhandle,"$"."not_elems = '".$_not_elems. "';");
            fwrite($fhandle, "\n\n// Use element-list to index only HTML element content\n");
            fwrite($fhandle,"$"."use_elems = '".$_use_elems. "';");
            fwrite($fhandle, "\n\n// Delete HTML elements defined like & l t ; element & g t ; \n");
            fwrite($fhandle,"$"."del_elems = '".$_del_elems. "';");
            fwrite($fhandle, "\n\n// Convert punycode URLs in full text into readable\n");
            fwrite($fhandle,"$"."conv_puny = '".$_conv_puny. "';");
            fwrite($fhandle, "\n\n// Delete secondary characters at the beginning and end of words\n");
            fwrite($fhandle,"$"."del_secchars = '".$_del_secchars. "';");
            fwrite($fhandle, "\n\n// Delete secondary characters inside of words\n");
            fwrite($fhandle,"$"."del_seccharin = '".$_del_seccharin. "';");
            fwrite($fhandle, "\n\n// Use simple quotes \n");
            fwrite($fhandle,"$"."quotes = '".$_quotes. "';");
            fwrite($fhandle, "\n\n// Convert double quotes \n");
            fwrite($fhandle,"$"."dup_quotes = '".$_dup_quotes. "';");
            fwrite($fhandle, "\n\n// Convert accents into their basic vowels \n");
            fwrite($fhandle,"$"."vowels = '".$_vowels. "';");
            fwrite($fhandle, "\n\n// User agent string \n");
            fwrite($fhandle,"$"."user_agent = '".$_user_agent. "';");
            fwrite($fhandle, "\n\n// Browser http_agent_string \n");
            fwrite($fhandle,"$"."browser_string = '".$_browser_string. "';");
            fwrite($fhandle, "\n\n// Always use Firefox HTTP_USER_AGENT \n");
            fwrite($fhandle,"$"."default_agent = '".$_default_agent. "';");
            fwrite($fhandle, "\n\n// Use charset as supplied by the server \n");
            fwrite($fhandle,"$"."server_char = '".$_server_char. "';");
            fwrite($fhandle, "\n\n// Minimal delay between page downloads \n");
            fwrite($fhandle,"$"."min_delay = ".$_min_delay. ";");
            fwrite($fhandle, "\n\n// Use word stemming for language \n");
            fwrite($fhandle,"$"."stem_words = '".$_stem_words. "';");
            fwrite($fhandle, "\n\n// Strip session ids (PHPSESSID, JSESSIONID, ASPSESSIONID, sid) \n");
            fwrite($fhandle,"$"."strip_sessids = ".$_strip_sessids. ";");
            fwrite($fhandle, "\n\n// additionally strip session id: s \n");
            fwrite($fhandle,"$"."strip_s_sessids = ".$_strip_s_sessids. ";");
            fwrite($fhandle, "\n\n// Allow other hosts in same domain for all found links, and also ignore www. \n");
            fwrite($fhandle,"$"."other_host = ".$_other_host. ";");
            fwrite($fhandle, "\n\n// For redirected links allow other hosts in same domain, and also ignore www. \n");
            fwrite($fhandle,"$"."redir_host = ".$_redir_host. ";");
            fwrite($fhandle, "\n\n// Crawler can leave domain, but only for canonical links. \n");
            fwrite($fhandle,"$"."cano_leave = ".$_cano_leave. ";");
            fwrite($fhandle, "\n\n// Follow redirections found in JavaScript. \n");
            fwrite($fhandle,"$"."js_reloc = ".$_js_reloc. ";");
            fwrite($fhandle, "\n\n// Delete duplicates in link path. \n");
            fwrite($fhandle,"$"."dup_path = ".$_dup_path. ";");
            fwrite($fhandle, "\n\n// Index only documents \n");
            fwrite($fhandle,"$"."only_docs = ".$_only_docs. ";");
            fwrite($fhandle, "\n\n// Index only links and their titles \n");
            fwrite($fhandle,"$"."only_links = ".$_only_links. ";");
            fwrite($fhandle, "\n\n// Enable link-check instead of reindex \n");
            fwrite($fhandle,"$"."link_check = ".$_link_check. ";");
            fwrite($fhandle, "\n\n// Enable index and re-index for pages with duplicate content \n");
            fwrite($fhandle,"$"."dup_content = ".$_dup_content. ";");
            fwrite($fhandle, "\n\n// Split words into their basic parts, separated at hyphens, dots and commas \n");
            fwrite($fhandle,"$"."div_all = ".$_div_all. ";");
            fwrite($fhandle, "\n\n// Split words into their basic parts, separated only at hyphens \n");
            fwrite($fhandle,"$"."div_hyphen = ".$_div_hyphen. ";");
            fwrite($fhandle, "\n\n// Decode BBcode during index \n");
            fwrite($fhandle,"$"."bb_decode = ".$_bb_decode. ";");
            fwrite($fhandle, "\n\n// Decode UTF-8 HTML entities during index \n");
            fwrite($fhandle,"$"."ent_decode = ".$_ent_decode. ";");
            fwrite($fhandle, "\n\n// Support Greek language \n");
            fwrite($fhandle,"$"."greek = ".$_greek. ";");
            fwrite($fhandle, "\n\n// Support Cyrillic language \n");
            fwrite($fhandle,"$"."cyrillic = ".$_cyrillic. ";");
            fwrite($fhandle, "\n\n// Perform a segmentation of Chinese text during index \n");
            fwrite($fhandle,"$"."cn_seg = ".$_cn_seg. ";");
            fwrite($fhandle, "\n\n// Perform a segmentation of Japanese text during index \n");
            fwrite($fhandle,"$"."jp_seg = ".$_jp_seg. ";");
            fwrite($fhandle, "\n\n// User name1 for password protected pages \n");
            fwrite($fhandle,"$"."user1 = '".$_user1. "';");
            fwrite($fhandle, "\n\n// Password1 for password protected pages \n");
            fwrite($fhandle,"$"."pwd1 = '".$_pwd1. "';");
            fwrite($fhandle, "\n\n// User name2 for password protected pages \n");
            fwrite($fhandle,"$"."user2 = '".$_user2. "';");
            fwrite($fhandle, "\n\n// Password2 for password protected pages \n");
            fwrite($fhandle,"$"."pwd2 = '".$_pwd2. "';");
            fwrite($fhandle, "\n\n// User name3 for password protected pages \n");
            fwrite($fhandle,"$"."user3 = '".$_user3. "';");
            fwrite($fhandle, "\n\n// Password3 for password protected pages \n");
            fwrite($fhandle,"$"."pwd3 = '".$_pwd3. "';");

            fwrite($fhandle,"\n\n\n/*********************** \nSearch settings \n***********************/");
            fwrite($fhandle, "\n\n//Language of the search page \n");
            fwrite($fhandle,"$"."language = '".$_language. "';");
            fwrite($fhandle, "\n\n//Auto detect client language\n");
            fwrite($fhandle,"$"."auto_lng = '".$_auto_lng. "';");
            fwrite($fhandle, "\n\n// Prevent queries from harvester, bots and known evial user-agents\n");
            fwrite($fhandle,"$"."kill_black_uas = ".$_kill_black_uas. ";");
            fwrite($fhandle, "\n\n// Prevent queries from Meta search engines like Google\n");
            fwrite($fhandle,"$"."kill_black_ips = ".$_kill_black_ips. ";");
            fwrite($fhandle, "\n\n// Prevent queries causing XSS attacks, Tag inclusions, Shell and JavaScript exec.\n");
            fwrite($fhandle,"$"."block_attacks = ".$_block_attacks. ";");
            fwrite($fhandle, "\n\n//Use cache for search results\n");
            fwrite($fhandle,"$"."use_cache = '".$_use_cache. "';");
            fwrite($fhandle, "\n\n//Cache size [MB] for text search results\n");
            fwrite($fhandle,"$"."tcache_size = '".$_tcache_size. "';");
            fwrite($fhandle, "\n\n//Cache size [MB] for media search results\n");
            fwrite($fhandle,"$"."mcache_size = '".$_mcache_size. "';");
            fwrite($fhandle, "\n\n//Max results/links per query in text cache\n");
            fwrite($fhandle,"$"."max_ctresults = '".$_max_ctresults. "';");
            fwrite($fhandle, "\n\n//Max results/links per query in media cache\n");
            fwrite($fhandle,"$"."max_cmresults = '".$_max_cmresults. "';");
            fwrite($fhandle, "\n\n//Clear text and media cache during re-index procedure\n");
            fwrite($fhandle,"$"."clear_cache = '".$_clear_cache. "';");
            fwrite($fhandle, "\n\n// Template design/Directory in templates dir\n");
            fwrite($fhandle,"$"."template = '".$_template. "';");
            fwrite($fhandle, "\n\n// Title for Results Page\n");
            fwrite($fhandle,"$"."mytitle = '".$_mytitle. "';");
            fwrite($fhandle, "\n\n//Type of highlighting for found keywords \n");
            fwrite($fhandle,"$"."mark = '".$_mark. "';");
            fwrite($fhandle, "\n\n// Default for number of results per page\n");
            fwrite($fhandle,"$"."results_per_page = ".$_results_per_page. ";");
            fwrite($fhandle, "\n\n// Can speed up searches on large database (should be 0)\n");
            fwrite($fhandle,"$"."bound_search_result = ".$_bound_search_result. ";");
            fwrite($fhandle, "\n\n// Number of links shown to next pages\n");
            fwrite($fhandle,"$"."links_to_next = ".$_links_to_next. ";");
            fwrite($fhandle, "\n\n// Show elapsed time in result header\n");
            fwrite($fhandle,"$"."elapsed = ".$_elapsed. ";");
            fwrite($fhandle, "\n\n// Show meta description in results page if it exists, otherwise show an extract from the page text.\n");
            fwrite($fhandle,"$"."show_meta_description = ".$_show_meta_description. ";");
            fwrite($fhandle, "\n\n// Show warning message if search string was found only in title or url.\n");
            fwrite($fhandle,"$"."show_warning = ".$_show_warning. ";");
            fwrite($fhandle, "\n\n// Advanced query form, shows and/or buttons\n");
            fwrite($fhandle,"$"."advanced_search = ".$_advanced_search. ";");
            fwrite($fhandle, "\n\n// Show actual result number for each result\n");
            fwrite($fhandle,"$"."show_res_num = ".$_show_res_num. ";	");
            fwrite($fhandle, "\n\n// Query scores are not shown if set to 0\n");
            fwrite($fhandle,"$"."show_query_scores = ".$_show_query_scores. ";	");
            fwrite($fhandle, "\n\n// Show the URL of each result\n");
            fwrite($fhandle,"$"."show_res_url = ".$_show_res_url. ";	");
            fwrite($fhandle, "\n\n// Search without quotes\n");
            fwrite($fhandle,"$"."no_quotes= ".$_no_quotes. ";	");
            fwrite($fhandle, "\n\n// Queries with numbers become wildsearch\n");
            fwrite($fhandle,"$"."wild_num= ".$_wild_num. ";	");
            fwrite($fhandle, "\n\n// Translitate queries from Latin characters to Greek \n");
            fwrite($fhandle,"$"."translit_el= ".$_translit_el. ";");
            fwrite($fhandle, "\n\n//Accept Greek vowels without accents \n");
            fwrite($fhandle,"$"."noacc_el= ".$_noacc_el. ";	");
            fwrite($fhandle, "\n\n // Display category list\n");
            fwrite($fhandle,"$"."show_categories = ".$_show_categories. ";");
            fwrite($fhandle, "\n\n // Display category selection at each result\n");
            fwrite($fhandle,"$"."more_catres = ".$_more_catres. ";");
            fwrite($fhandle, "\n\n// Max length of page title given in results page\n");
            fwrite($fhandle,"$"."title_length		= ".$_title_length. ";");
            fwrite($fhandle, "\n\n// Max length of URL given in results page\n");
            fwrite($fhandle,"$"."url_length		= ".$_url_length. ";");
            fwrite($fhandle, "\n\n// Length of page description given in results page\n");
            fwrite($fhandle,"$"."desc_length = ".$_desc_length. ";");
            fwrite($fhandle, "\n\n// Max hits shown per link in results page\n");
            fwrite($fhandle,"$"."max_hits		= ".$_max_hits. ";");
            fwrite($fhandle, "\n\n// Show order of result listing as headline\n");
            fwrite($fhandle,"$"."show_sort = ".$_show_sort. ";");
            fwrite($fhandle, "\n\n// Show media results as well as text results in result page\n");
            fwrite($fhandle,"$"."show_media = ".$_show_media. ";");
            fwrite($fhandle, "\n\n// Limit media results, if presented togetherr with text results in result page\n");
            fwrite($fhandle,"$"."limit_media = ".$_limit_media. ";");
            fwrite($fhandle, "\n\n// Search for media results also in EXIF and ID3 info\n");
            fwrite($fhandle,"$"."search_id3 = ".$_search_id3. ";");
            fwrite($fhandle, "\n\n// Chronological order of media result listing\n");
            fwrite($fhandle,"$"."sort_media = ".$_sort_media. ";");
            fwrite($fhandle, "\n\n// Show 'Most popular searches' at the bottom of result pages\n");
            fwrite($fhandle,"$"."most_pop = ".$_most_pop. ";");
            fwrite($fhandle, "\n\n// Suppress zero results in 'Most popular searches'\n");
            fwrite($fhandle,"$"."no_zeros = ".$_no_zeros. ";");
            fwrite($fhandle, "\n\n// Show 3D tag cloud in 'Most popular searches'\n");
            fwrite($fhandle,"$"."tag_cloud = ".$_tag_cloud. ";");
            fwrite($fhandle, "\n\n// Show 3D tag cloud in differernt colors for each query hit\n");
            fwrite($fhandle,"$"."color_cloud = ".$_color_cloud. ";");
            fwrite($fhandle, "\n\n// Number of rows for 'Most popular searches'\n");
            fwrite($fhandle,"$"."pop_rows = ".$_pop_rows. ";");
            fwrite($fhandle, "\n\n// Min. relevance level (%) to be shown at result pages\n");
            fwrite($fhandle,"$"."relevance = ".$_relevance. ";");
            fwrite($fhandle, "\n\n// Max. quantity of results for result listing\n");
            fwrite($fhandle,"$"."max_results = ".$_max_results. ";");
            fwrite($fhandle, "\n\n// Show db content at the bottom of result listing\n");
            fwrite($fhandle,"$"."db_content = ".$_db_content. ";");
            fwrite($fhandle, "\n\n// Show 'User may suggest a Url' at the bottom of result pages'\n");
            fwrite($fhandle,"$"."add_url = ".$_add_url. ";");
            fwrite($fhandle, "\n\n// Use authentification for suggested URLs\n");
            fwrite($fhandle,"$"."add_auth = ".$_add_auth. ";");
            fwrite($fhandle, "\n\n// Inform about user suggestion by e-mail\n");
            fwrite($fhandle,"$"."addurl_info = ".$_addurl_info. ";");
            fwrite($fhandle, "\n\n// Perform a WHOIS check for suggested URLs\n");
            fwrite($fhandle,"$"."whois_user = ".$_whois_user. ";");
            fwrite($fhandle, "\n\n// Perform a WHOIS check for suggested URLs in Admin backend\n");
            fwrite($fhandle,"$"."whois_admin = ".$_whois_admin. ";");
            fwrite($fhandle, "\n\n// Use extended suffix list for WHOIS checks\n");
            fwrite($fhandle,"$"."whois_ext = ".$_whois_ext. ";");
            fwrite($fhandle, "\n\n// Use Captcha for Addurl-form\n");
            fwrite($fhandle,"$"."captcha = ".$_captcha. ";");

            fwrite($fhandle,"\n\n\n/*********************** \nSuggest framework\n***********************/");
            fwrite($fhandle, "\n\n// Enable spelling suggestions (Did you mean...)\n");
            fwrite($fhandle,"$"."did_you_mean_enabled = ".$_did_you_mean_enabled. ";");
            fwrite($fhandle, "\n\n// Define min. character input for suggestion \n");
            fwrite($fhandle,"$"."min_sug_chars = ".$_min_sug_chars. ";");
            fwrite($fhandle, "\n\n// Search for suggestions in query log \n");
            fwrite($fhandle,"$"."suggest_history = ".$_suggest_history. ";");
            fwrite($fhandle, "\n\n// Search for suggestions in keywords \n");
            fwrite($fhandle,"$"."suggest_keywords = ".$_suggest_keywords. ";");
            fwrite($fhandle, "\n\n// Build suggestions also for phrases \n");
            fwrite($fhandle,"$"."suggest_phrases = ".$_suggest_phrases. ";");
            fwrite($fhandle, "\n\n// Search for suggestions in id3 tags \n");
            fwrite($fhandle,"$"."suggest_id3 = ".$_suggest_id3. ";");
            fwrite($fhandle, "\n\n// Show number of results in suggestion table \n");
            fwrite($fhandle,"$"."show_hits = ".$_show_hits. ";");
            fwrite($fhandle, "\n\n// Limit number of suggestions \n");
            fwrite($fhandle,"$"."suggest_rows = ".$_suggest_rows. ";");

            fwrite($fhandle,"\n\n\n/*********************** \nWeights and result order\n***********************/");
            fwrite($fhandle, "\n\n// Relative weight of a word in the title of a webpage\n");
            fwrite($fhandle,"$"."title_weight = ".$_title_weight. ";");
            fwrite($fhandle, "\n\n// Relative weight of a word in the domain name\n");
            fwrite($fhandle,"$"."domain_weight = ".$_domain_weight. ";");
            fwrite($fhandle, "\n\n// Relative weight of a word in the path name\n");
            fwrite($fhandle,"$"."path_weight = ".$_path_weight. ";");
            fwrite($fhandle, "\n\n// Relative weight of a word in meta_keywords\n");
            fwrite($fhandle,"$"."meta_weight = ".$_meta_weight. ";");
            fwrite($fhandle, "\n\n// Defines multiplier for words in main URLs (domains)\n");
            fwrite($fhandle,"$"."domain_mul = ".$_domain_mul. ";");
            fwrite($fhandle, "\n\n// Defines method of chronological order for result listing\n");
            fwrite($fhandle,"$"."sort_results = ".$_sort_results. ";");
            fwrite($fhandle, "\n\n// Name of promoted domain\n");
            fwrite($fhandle,"$"."dompromo = '".$_dompromo. "';");
            fwrite($fhandle, "\n\n// Name of promoted catchword\n");
            fwrite($fhandle,"$"."keypromo = '".$_keypromo. "';");
            fwrite($fhandle, "\n\n// Max results per domain in result listing\n");
            fwrite($fhandle,"$"."dom_count = '".$_dom_count. "';");
            fwrite($fhandle,"\n\n?>");
            fclose($fhandle);

            //  output 'ready' messsage after storage of settings
            echo "<div class='submenu cntr'>| Configuration Settings |</div>
                    <div class='headline cntr'>Settings for Sphider-plus version $plus_nr based on original Sphider v. $version_nr</div>
                    <div class='odrow'>
                    <br /><br />
                    <p class='txt cntr'>New settings had been saved for <strong>database $dba_act</strong> and table set <strong>$mysql_table_prefix</strong></p>
                    <br /><br />
                ";

            //  warning message, if "Use Arabic common list" was activated
            if ($_use_common == 'ar' && $use_common != 'ar') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Arabic common list' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting was necessarily also activated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if "Use Arabic common list" was deactivated
            if ($_use_common != 'ar' && $use_common == 'ar') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Arabic common list' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following setting for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if "Use Chinese common list" was activated
            if ($_use_common == 'cn' && $use_common != 'cn') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Chinese common list' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting was necessarily also activated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if "Use Chinese common list" was deactivated
            if ($_use_common != 'cn' && $use_common == 'cn') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Chinese common list' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following setting for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }
            //  warning message, if "Use Cyrillic common list" was activated
            if ($_use_common == 'ru' && $use_common != 'ru') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Cyrillic common list' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting was necessarily also activated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if "Use Cyrillic common list" was deactivated
            if ($_use_common != 'ru' && $use_common == 'ru') {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use Cyrillic common list' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following setting for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message
            if ($_use_elems == "1" && $use_elems == "0") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use list of HTML elements to ignore the element content during index/re-index'</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>has been activated, the following setting was necessarily deactivated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Use list of div ids to index only the div content during index/re-index.</p>
                        <p class='txt cntr '>&nbsp;</p>
                    ";
            }

            //  warning message
            if ($_not_elems == "1" && $not_elems == "0") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Use list of HTML elements to ignore the element content during index/re-index'</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>has been activated, the following setting was necessarily deactivated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Use list of div ids to ignore the div content during index/re-index.</p>
                        <p class='txt cntr '>&nbsp;</p>
                    ";
            }

            //  warning message
            if ($_ignore_fulltxt == "1" && $ignore_fulltxt == "0") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Do not index the full text' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting were necessarily deactivated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Use list of div ids to ignore the div content during index/re-index.</p>
                        <p class='txt cntr bd'>Use list of div ids to index only the div content during index/re-index.</p>
                        <p class='txt cntr bd'>Index media content like images, audio and video.</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Instead the following settings had been activated necessarily: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Index the 'Title' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Keyword' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Description' Meta tag in HTML header.</p>
                        <p class='txt cntr '>&nbsp;</p>
                    ";
            }

            //  warning message
            if ($_ignore_fulltxt == "0" && $ignore_fulltxt == "1") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Do not index the full text' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following settings for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Use list of div ids to ignore the div content during index/re-index.</p>
                        <p class='txt cntr bd'>Use list of div ids to index only the div content during index/re-index.</p>
                        <p class='txt cntr bd'>Index media content like images, audio and video.</p>
                        <p class='txt cntr bd'>Index the 'Title' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Keyword' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Description' Meta tag in HTML header.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if multithreaded indexing was activated
            if ($_multi_indexer > "1" && $multi_indexer == "1") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Multithreaded indexing' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting were necessarily deactivated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable real-time output of logging data.</p>
                        <p class='txt cntr bd'>Index word documents like PDF, DOC, RTF and PPT.</p>
                        <p class='txt cntr bd'>Additionally the periodical Re-indexer has been set to \"never\"</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Instead the following settings had been activated necessarily: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Log spidering results into a Log-file.</p>
                        <p class='txt cntr bd'>Suppress browser output of logging data during index / re-index.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if multithreaded indexing was deactivated
            if ($_multi_indexer == "1" && $multi_indexer > "1") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Multithreaded indexing' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following settings for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Enable real-time output of logging data.</p>
                        <p class='txt cntr bd'>Index word documents like PDF, DOC, RTF and PPT.</p>
                        <p class='txt cntr bd'>Log spidering results into a Log-file.</p>
                        <p class='txt cntr bd'>Suppress browser output of logging data during index / re-index.</p>
                        <p class='txt cntr bd'>Interval for periodical Re-indexer.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if periodical Re-indexing was activated
            if ($_interval != "never" && $interval == "never") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Periodical Re-indexing' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting was necessarily set to 1: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Define max. number of threads allowed for index procedures.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if periodical Re-indexing was deactivated
            if ($_interval == "never" && $interval != "never") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Periodical Re-indexing' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>please check the following setting for your personal needings: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Define max. number of threads allowed for index procedures.</p>
                        <p>&nbsp;</p>
                    ";
            }



            //  warning message, if indexing of links (instead of full text) was activated
            if ($_only_links == "1" && $only_links == "0") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Index only links and their titles' has been activated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting were necessarily deactivated: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Index only documents.</p>
                        <p class='txt cntr bd'>Index media content like images, audio and video.</p>
                        <p class='txt cntr bd'>Index words in Domain Name and URL path.</p>
                        <p class='txt cntr bd'>Index the 'Title' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Keyword' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Description' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>In addition to text results, also show media results in result listing.</p>
                        <p class='txt cntr bd'>Find media results not only by file name and media title, but also by EXIF and ID3 info.</p>
                        <p class='txt cntr bd'>Show warning message if query was not found in full text.</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if indexing of links (instead of full text) was deactivated
            if ($_only_links == "0" && $only_links == "1") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because 'Index only links and their titles' has been deactivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>the following setting might need to be activated again: </p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Index only documents.</p>
                        <p class='txt cntr bd'>Index media content like images, audio and video.</p>
                        <p class='txt cntr bd'>Index words in Domain Name and URL path.</p>
                        <p class='txt cntr bd'>Index the 'Title' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Keyword' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>Index the 'Description' Meta tag in HTML header.</p>
                        <p class='txt cntr bd'>In addition to text results, also show media results in result listing.</p>
                        <p class='txt cntr bd'>Find media results not only by file name and media title, but also by EXIF and ID3 info.</p>
                        <p class='txt cntr bd'>Show warning message if query was not found in full tex.t</p>
                        <p class='txt cntr '>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }

            //  warning message, if segmentation of Asian langues is activated   =>  $case_sensitive = 1
            if ($case_sensitive == "0" ) {
                if ($_jp_seg == "1" && $jp_seg == "0" || $_cn_seg == "1" && $cn_seg == "0") {
                    echo "  <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr'>Attention: Because Asian language segmentation has been activated,</p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr'>the following setting was necessarily also activated: </p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries</p>
                            <p class='txt cntr '>&nbsp;</p>
                            <p>&nbsp;</p>
                        ";
                }
            }

            //  warning message if segmentation of Asian languages was deactivated
            if ($_case_sensitive == "1" ) {
                if ($_jp_seg == "0" && $jp_seg == "1" || $_cn_seg == "0" && $cn_seg == "1") {
                    echo "  <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr'>Attention: Because Asian language segmentation has been dectivated,</p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr'>also the following setting might not be required any longer:</p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr bd'>Enable distinct results for upper- and lower-case queries</p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p class='txt cntr'>It needs to be deactivated manually.</p>
                            <p class='txt cntr'>&nbsp;</p>
                            <p>&nbsp;</p>
                        ";
                }
            }

            //  warning message if displaying of URL in result listing was deactivated
            if ($_show_res_url == "0" && $show_query_scores == "1") {
                echo "  <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>Attention: Because displaying of result URL has been dectivated,</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>also the following setting was necessarily deactivated:</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr bd'>Show result scores (weighting % or hit counts in full text)</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p class='txt cntr'>It needs to be deactivated manually.</p>
                        <p class='txt cntr'>&nbsp;</p>
                        <p>&nbsp;</p>
                    ";
            }



            echo "<p class='txt cntr'>
                    <a class='bkbtn' href='admin.php?f=settings' title='Reload Settings'>Complete this process</a>
                    <br /><br />
                    </div></div></div>
                    </body>
                    </html>
                ";
            die ('');
        }

    }

    $plus_nr = '';
    @include "".$settings_dir."/db".$dba_act."/conf_".$mysql_table_prefix.".php";
    if (!$plus_nr) {    //  if not exists, load default configuration file.
        include "/settings/backup/Sphider-plus_default-configuration.php";
    }

    if ($qcache == 1) {
        //  try to initialize a 32 MByte MySQL cache  (might not work on shared hosting systems)  33554432
        $mysql_csize    = @mysql_query("SET GLOBAL query_cache_size = 33554432");
        $mysql_cacheon  = @mysql_query("SET GLOBAL query_cache_type = ON") ;
        if ($clear == 1) {
            $mysql_reset    = @mysql_query("RESET QUERY CACHE");
        }
    }

    require_once "$include_dir/domain_whois.php";
    $whois_res  = '';
    $whois      = '';
    $list       = "1";     //  get list
    $ext        = "0";     //  basic suffixes

    $whois  = new whois(); //new class
    $whois_res0 = $whois->lookup($url, $ext, $list);

    $ext        = "1";     //  extended list
    $whois_res1 = $whois->lookup($url, $ext, $list);
    unset($whois);
    $whois_basic    = preg_replace("/\s+/","", $whois_res0['answer']);
    $whois_full     = preg_replace("/\s+/","", $whois_res1['answer']);

    echo "<div class='submenu cntr'>| Configuration Settings |</div>
            <div class='headline cntr'>Settings for Sphider-plus version $plus_nr based on original Sphider v. $version_nr</div>
            <br />
            ";
    if (!$db_con || !$success || !$tables) {
        echo "<center><span class='red sml'>&nbsp;MySQL database is not avaliable!&nbsp;<br />
                  &nbsp;First define all required information in section 'Database'&nbsp;</span>
                </center><br />
                ";
    }
    if ($db_con && $success) {
        $result ='';
        $result = @mysql_query("select sum(click_counter) from ".$mysql_table_prefix."links");
        if(mysql_error()){
            echo "<center><span class='red sml'>&nbsp;MySQL database tables are not available!&nbsp;<br />
                      &nbsp;Run 'Install all tables' in 'Database' section&nbsp;</span>
                    </center><br />
                    ";
        }
    }
    echo "
            <fieldset><legend>[ Settings Overview ]</legend>
                <br />
                <table width=\"90%\"  border=\"1\">
                    <tr>
                        <td width=\"50%\">
                            <blockquote>
                            <p>The following sections are available to configure Sphider-plus:</p>
                                <li>- <a href='#set_1'>General Settings</a></li>
                                <li>- <a href='#set_1a'>Admin Settings</a></li>
                                <li>- <a href='#set_2'>Index Log Settings</a></li>
                                <li>- <a href='#set_4'>Spider Settings</a></li>
                                <li>- <a href='#set_5'>Search Settings</a></li>
                                <li>- <a href='#set_6'>Suggestion Options</a></li>
                                <li>- <a href='#set_7'>Page Indexing Weights</a></li>
                            </blockquote>
                        </td>
                        <td>
                            <blockquote>
                            <p>In order to create a backup of the current settings, or restore a former setting, enter here:</p>
                            </blockquote>
                            <form class='cntr' name='form2' method='post' action='admin.php?f=41'>
                            <input class='sbmt' type='submit' value='Enter' id='submit' title='Click once to manage settings backup' />
                            </form>
                        </td>
                    </tr>
                </table>
                <br />
        ";
    $noPDF = '';
    $suggest_pdf = "/PATH/TO/YOUR/WEB/DOWN/TO/converter/pdftotext"; //  global info until we find the correct path
    $admin_path = $_SERVER['SCRIPT_FILENAME'];                      // that might work for shared hosting server

    if ($admin_path && $_op_system != 'win') {
        $admin_path = str_replace("\\\\", "/", $admin_path);
        $admin_path = str_replace("\\", "/", $admin_path);

        $suggest_pdf = substr($admin_path, 0, strrpos($admin_path, "/"));
        $suggest_pdf = substr($suggest_pdf, 0, strrpos($suggest_pdf, "/"));
    }

    if ($_op_system == 'win') {
        $suggest_pdf = "..\converter\pdftotext";
    } else {
        if ($admin_path) {
            $suggest_pdf = "".$suggest_pdf."/converter/pdftotext";
        }
    }

    if (!$handle = fopen($pdftotext_path, 'rb')) {      //      try to find the PDF converter
        $noPDF = '1';
    }
    echo "
            </fieldset>
            <br />
            <div id='settings'>
            <form class='txt' name='form1' method='post' action='admin.php'>
            <fieldset><legend><a name=\"set_1\">[ General Settings ]</a></legend>


            <label for='dummy_c01'>____________________________________________________________________<br /><br /></label>

            <label for='home_charset'>Enter your preferred charset :</label>
            <input name='_home_charset' id='home_charset' value='$home_charset' type='text' size='24' title='Enter your local charset (e.g. ISO-8859-1).'
            />
            <p>(Will only be required for files not containing any charset definition)</p>
            <p>&nbsp;</p>
            <label for='admin_email'>Administrator e-mail address :</label>
            <input name='_admin_email' id='admin_email' value='$admin_email' type='text' size='24' title='Enter email address for info and log posting'
            />
            <label for='dispatch_email'>Dispatcher e-mail address :</label>
            <input name='_dispatch_email' id='dispatch_email' value='$dispatch_email' type='text' size='24' title='Enter email address for log and info mail transmission'
            />
            <label for='local'>Address to localhost document root :</label>
            <input name='_local' id='local' value='$local' type='text' size='24' title='Enter the address to your local root folder'
            />
            <p>(The URL should always end with a slash)</p>
            <p>&nbsp;</p>
        ";
    if ($noPDF == '1') {
        echo "
                <label for='pdf_path'><span class='warnadmin'>Enter here the address to the PDF converter : > > > </span></label>
                <input name='_pdftotext_path' id='pdftotext_path' value='$pdftotext_path' type='text' size='24' title='Enter the address to your local root folder'
                />
            <p>(As per default setting, it should work with&nbsp;&nbsp;&nbsp;<strong><span class='warnadmin'>$suggest_pdf</span></strong> )</p>
            ";
    } else {
        echo "<label for='pdf_path'>Path and filename of PDF converter :</label>
                <input name='_pdftotext_path' id='pdftotext_path' value='$pdftotext_path' type='text' size='24' title='Enter the address to your local root folder'
            />
            <p>(As per default setting, it should work with&nbsp;&nbsp;&nbsp;<strong>$suggest_pdf</strong> )</p>
        ";
    }
    if ($noPDF == '1' && $_op_system != 'win') {    //  if the PDF converter was found and we use a LINUX / UNIX operating system
        echo "
                <p><span class='warnadmin'>For LINUX and UNIX systems you also need to place manually the full path <br />to the PDF converter into the Sphider-plus script <strong>.../converter/pdftotext</strong> </span></p>
            ";
    }
    echo "
            <p>&nbsp;</p>
            <label for='templ_dir'>Template directory (relative to Sphider-plus root directory) :</label>
            <input name='_templ_dir' type='text'  value='$templ_dir' id='templ_dir' size='14' title='Enter name of Template Folder'
            />
            <label for='template'>Template design:</label>
            <select name='_template' size='4'>
        ";

    $directories = get_dir_contents($template_dir);
    if (count($directories)>0) {
        for ($i=0; $i<count($directories); $i++) {
            $tdir=$directories[$i];
            if ($tdir != "html") {
                echo "<option id='temp".$i."' value='".$tdir."'";
                if ($tdir==$template) {
                    echo " selected='selected'";
                }
                echo ">$tdir</option>
                    ";
            }
        }
        echo "</select>
            ";
    }
    echo "
            <p>&nbsp;</p>
            <label for='tmp_dir'>Temporary directory (relative to admin directory) :</label>
            <input name='_tmp_dir' type='text'  value='$tmp_dir' id='tmp_dir' size='14' title='Enter name of Temporary Folder'
            />
            <p>&nbsp;</p>
            <label for='smap_dir'>Sitemap directory (relative to admin directory) :</label>
            <input name='_smap_dir' type='text'  value='$smap_dir' id='smap_dir' size='20' title='Enter name of Sitemap Folder'
            />
            <p>&nbsp;</p>
            <label for='search_script'>Name of search script :</label>
            <input name='_search_script' type='text'  value='$search_script' id='search_script' size='14' title='Enter name of search script'
            />
            <p>&nbsp;</p>

            <label for='embedded'>Embed 'Search form' and 'Result listing' into an existing HTML page :</label>
            <input name='_embedded' type='checkbox' id='embedded' value='1' title='Leave blank for stand alone HTML application.'
        ";
    if ($embedded==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Select, if HTML part of Sphider-plus is used integrated into an existing<br />HTML page. Leave blank for stand alone HTML application.)</p>
            <p>&nbsp;</p>
            <label for='use_ids'>Use 'Intrusion Detection System' to prevent input attacks :</label>
            <input name='_use_ids' type='checkbox' id='use_ids' value='1' title='Select, if you want to protect Sphider-plus against intrusion attacks.'
        ";
    if ($use_ids==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='ids_blocked'>Block further Internet traffic of IP's, which caused intrusion attempts :</label>
            <input name='_ids_blocked' type='checkbox' id='ids_blocked' value='1' title='Select, if you want to protect Sphider-plus against further intrusion attacks from IPs known to be eval.'
        ";
    if ($ids_blocked==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='qcache'>Enable 32 MByte MySQL query cache :</label>
            <input name='_qcache' type='checkbox' id='qcache' value='1' title='Select to activate 32 MByte cache for MySQL queries.'
        ";
    if ($qcache==1 ) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='debug'>Enable MySQL and PHP error messages :</label>
            <input name='_debug' type='checkbox' id='error' value='1' title='Select to get all error messages, warnings and notices from PHP and MySQL.'
        ";
    if ($debug == 1 || $debug == 2) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='debug'>Use string list of 'URL Must Not include' also to prevent erasing of involved URLs :</label>
            <input name='_not_erase' type='checkbox' id='not_erase' value='1' title='Select to skip all URLs containing any word of this liist during erasing procedure.'
        ";
    if ($not_erase == 1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(If activated, also unreachable links and their content will not be deleted from the database.)</p>
            <p>&nbsp;</p>
            <label for='htaccess'>Protect the .../admin/ folder by means of a .htaccess file:</label>
            <input name='_htaccess' type='checkbox' id='htaccess' value='1' title='Select, if you want to protect the folder.'
        ";
    if ($htaccess==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Do not activate, if remote access is required for the Admin backend)</p>
            <p>&nbsp;</p>
            <label for='debug'>Enable Debug mode for Admin backend:</label>
            <input name='_debug' type='checkbox' id='debug' value='2' title='Select, if you want to see details from index / re-index procedure.'
        ";
    if ($debug==2) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will present details during index / re-index and search procedures,<br />as well as MySQL and PHP messages.)</p>
            <p>&nbsp;</p>

            <label for='debug_user'>Enable Debug mode for User interface:</label>
            <input name='_debug_user' type='checkbox' id='debug_user' value='1' title='Select, if you want to see result details about database and cache.'
        ";
    if ($debug_user == 1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will present details during search procedure<br />concerning cache activity and involved databases.<br />
            Recommended to be deselected on production systems,<br />as these messages could reveal sensitive information.)</p>
            <label for='dummy_s1'>______________________________<br /><br /></label>
            <label for='submit'>Save all Settings :</label>
            <input class='sbmt' type='submit' value='Save' id='submit4' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            <form class='txt' name='form1a' method='post' action='admin.php'>
            <fieldset><legend><a name=\"set_1a\">[ Admin Settings ]</a></legend>

            <br /><br />
            <label for='sites_per_page'>Default sites per page in Admin backend:</label>
            <input type= 'radio' name='_sites_per_page' value='10' title='Select default sites per search page'
        ";
    if ($sites_per_page==10) {
        echo " checked='checked'";
    }
    echo "
            />10<br />
            <input class='ltfloat' type='radio' name='_sites_per_page' id='sites_per_page' value='20'
        ";
    if($sites_per_page==20) {
        echo " checked='checked'";
    }
    echo "
            />20 <br />
            <input class='ltfloat' type='radio' name='_sites_per_page' value='30'
        ";
    if($sites_per_page==30) {
        echo " checked='checked'";
    }
    echo "
            />30 <br />
            <input class='ltfloat' type='radio' name='_sites_per_page' value='50'
        ";
    if ($sites_per_page==50) {
        echo " checked='checked'";
    }
    echo "
            />50<br />
            <input class='ltfloat' type='radio' name='_sites_per_page' value='100'
        ";
    if ($sites_per_page==100) {
        echo " checked='checked'";
    }
    echo "
            />100<br />
            <p>&nbsp;</p>
            <label for='sites_alpha'>Admin's 'Sites' table sorted in alphabetic order :</label>
            <input name='_sites_alpha' type='checkbox' id='sites_alpha' value='1' title='Select for Admin Site table sorted in alphabetic order'
        ";
    if ($sites_alpha==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='sites_latest'>Admin's 'Sites' table sorted by indexdate. Latest index date on top :</label>
            <input name='_sites_latest' type='checkbox' id='sites_latest' value='1' title='Select for Admin Site table sorted by indexdate.'
        ";
    if ($sites_latest==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='sites_oldest'>Admin's 'Sites' table sorted by indexdate. Oldest index date on top :</label>
            <input name='_sites_oldest' type='checkbox' id='sites_oldest' value='1' title='Select for Admin Site table sorted by indexdate.'
        ";
    if ($sites_oldest==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='sites_title'>Admin's 'Sites' table sorted by title, as defined when adding new site :</label>
            <input name='_sites_title' type='checkbox' id='sites_title' value='1' title='Select for Admin Site table sorted by title.'
        ";
    if ($sites_title==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='idna'>Accept non-ASCII URLs with 'Internationalized Domain Names' (IDN) to be added :</label>
            <input name='_idna' type='checkbox' id='idna' value='1' title='Select to accept all kind of URLs'
        ";
    if ($idna==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>If activated, internationalized domain names like 'http://президент.рф/' and 'http://müller.de/'<br />will be accepted as new sites in Admin backend, as well as in User's addurl form.</p>
            <p>&nbsp;</p>
            <label for='show_url'>Show complete list of URLs during import and export :</label>
            <input name='_show_url' type='checkbox' id='show_url' value='1' title='Select for presenting all URLs during import/export'
        ";
    if ($show_url==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='clear'>Clean resources during index / re-index and also for search function :</label>
            <input name='_clear' type='checkbox' id='clear' value='1' title='Select, if you index large numbers of URLs.'
        ";
    if ($clear==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Check only if you index large numbers of URLs.<br />Selection will reduce performance.)<br /><br /></p>
            <label for='clear_query'>Clean 'Query Log' during index / re-index and also during all erase functions :</label>
            <input name='_clear_query' type='checkbox' id='clear_query' value='1' title='Select to reset the query log'
        ";
    if ($clear_query==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will reset all 'Search' statistics in Admin backend, as well as the<br /> 'Most popular search' table at the bottom of result listing)</p>
            <p>&nbsp;</p>
            <label for='auto_add'>Add new domains found during index procedure to 'Approve Sites' table :</label>
            <input name='_auto_add' type='checkbox' id='auto_add' value='1' title='Select, if new URLs should be remembered for later approval.'
        ";
    if ($auto_add==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Check only if 'Spider can leave domain' is activated in sites options.<br />Selection will reduce performance.)<br /><br /></p>
            <label for='del_related'>If a site is deleted from the admin backend,&nbsp;<br /> also delete all keywords related to that site :</label>
            <input name='_del_related' type='checkbox' id='del_related' value='1' title='Select to delete all related database entries'
        ";
    if ($del_related==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='dummy_s1'>______________________________<br /><br /></label>

            <label for='submit'>Save all Settings :</label>
            <input class='sbmt' type='submit' value='Save' id='submit4a' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            <fieldset><legend><a name=\"set_2\">[ Index Log Settings ]</a></legend>
            <p>&nbsp;</p>
            <label for='keep_log'>Log spidering results into a Log-file :</label>
            <input name='_keep_log' type='checkbox' id='keep_log' value='1' title='Select to enable spider logging'
        ";
    if ($keep_log==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='log_dir'>Log directory (relative to admin directory) :</label>
            <input name='_log_dir' type='text'  value='$log_dir' id='log_dir' size='20' title='Enter name of Log Folder'
            />
            <label for='log_format'>Log file format:</label>
            <select name='_log_format' id='log_format' title='Select default log file output option'>
            <option value='html'
        ";
    if ($log_format == "html") {
        echo " selected='selected'";
    }
    echo ">HTML</option>
            <option value='text'";
    if ($log_format == "text") {
        echo " selected='selected'";
    }
    echo ">Text</option></select>
            <p>&nbsp;</p>
            <label for='no_log'>Suppress browser output of logging data during index / re-index :</label>
            <input name='_no_log' type='checkbox' id='no_log' value='1' title='Select to disable output of logging data to your browser'
        ";
    if ($no_log==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will speed up index / re-index procedure and prevent&nbsp;&nbsp; <br />browser overflow on huge amount of sites to be indexed)</p>
            <p>&nbsp;</p>

            <label for='real_log'>Enable real-time output of logging data :</label>
            <input name='_real_log' type='checkbox' id='real_log' value='1' title='Select for real-time output of logging data to your browser'
        ";
    if ($real_log==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='refresh'>Update interval for logging data (max.10 seconds) : </label>
            <input name='_refresh' type='text' id='refresh' size='1' maxlength='2' value='$refresh'
            title='Real-time output will be updated every X seconds.'
            />
            <p>&nbsp;</p>
            <label for='email_log'>Send spidering log to e-mail :</label>
            <input name='_email_log' type='checkbox' id='email_log' value='1' title='Select to auto-send log file by email'
        ";
    if ($email_log==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='click_wait'>Timeout in order to prevent promoted clicks&nbsp;&nbsp;<br />until next click for 'Most Popular Links' will be accepted [seconds] : </label>
            <input name='_click_wait' type='text' id='click_wait' size='2' maxlength='2' value='$click_wait'
            title='Every x seconds a new click will be used to increase popularity of a link.'
            />
            <p>&nbsp;</p>
            <label for='dummy_s2'>______________________________<br /><br /></label>
            <label for='submit2'>Save all Settings :</label>
            <input class='sbmt' type='submit' id='submit2' value='Save' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            <br />
            </fieldset>
            <br />
            <fieldset><legend><a name=\"set_4\">[ Spider Settings ]</a></legend><br />
            <p class='warnadmin sml'>If you modify any settings in this section, you are obliged to run</p>
            <p class='warnadmin sml'>'Erase &amp; Re-index all'.</p>
            <p>&nbsp;</p>
            <label for='user_agent'>User agent string :</label>
            <input name='_user_agent' value='$user_agent' type='text' id='user_agent' size='20'
            title='Enter identifier of your spider for remote log files'
            />
            <p>&nbsp;</p>
            <label for='browser_string'>If the user agent string  '$user_agent' is not accepted by the site to be indexed,<br />try to use the standard Firefox HTTP_USER_AGENT string :</label>
            <input name='_browser_string' type='checkbox' value='1' id='browser_string'
            title='If activated, the Firefox HTTP_USER_AGENT will be used'
            ";
    if ($browser_string==1) {
        echo " checked='checked'";
    }
    echo" />

            <label for='default_agent'>Always use the standard Firefox HTTP_USER_AGENT string :</label>
            <input name='_default_agent' type='checkbox' value='1' id='default_agent'
            title='If activated, the Firefox HTTP_USER_AGENT will be used'
            ";
    if ($default_agent==1) {
        echo " checked='checked'";
    }
    echo" />

            <p>&nbsp;</p>

            <label for='server_char'>In order to convert the text into UTF-8,<br /> use the charset definition as supplied via HTTP by the client server :</label>
            <input name='_server_char' type='checkbox' value='1' id='server_char'
            title='If activated, allways the charset as supplied by the server will be used'
            ";
    if ($server_char==1) {
        echo " checked='checked'";
    }
    echo" />
            <p>(If not activated, the charset will be extracted from the header of the files to be indexed.<br />If not found, like in PDF documents, the preferred charset will be used.)</p>
            <p>&nbsp;</p>



            <label for='min_delay'>Minimal delay between page downloads :</label>
            <input name='_min_delay' value='$min_delay' type='text' id='min_delay' size='5'
            title='Enter time delay in seconds between downloaded pages'
            />
            <p>&nbsp;</p>
            <label for='multi_indexer'>Define max. number of threads allowed for index procedures :</label>
            <input name='_multi_indexer' value='$multi_indexer' type='text' id='multi_indexer' size='2'
            title='Enter count of threads for indexing'
            />
            <p>(Should be defined between 1 and 10)</p>
            <p>&nbsp;</p>
            <label for='max_links'>Max. links to be followed for each Site :</label>
            <input name='_max_links' type='text'  value='$max_links' id='max_links' size='5' title='Enter max. links to be followed for each url'
            />
            <p>&nbsp;</p>
            <label for='interrupt'>Interrupt the indexer periodically. Interrupt every count of links :</label>
            <input name='_interrupt' type='text'  value='$interrupt' id='interrupt' size='5' title='Enter the count of pages until next interrupt'
            />
            <p>(Leave blank for continuous indexing)</p>
            <p>&nbsp;</p>
            <label for='min_words_per_page'>Required number of words in a page in order to get indexed :</label>
            <input name='_min_words_per_page' value='$min_words_per_page' type='text' id='min_words_per_page' size='5' maxlength='5'
             title='Enter minimum number of unique words to qualify the page for indexing'
            />";

    echo "
            <label for='min_word_length'>Minimum word length (characters) in order to be indexed :</label>
            <input name='_min_word_length' type='text' value='$min_word_length' id='min_word_length' size='5' maxlength='2'
             title='Enter the minimum count of letters in words to get indexed'
            />
            <label for='word_upper_bound'> Limit the count of a keyword allowed (and counted) in full text to:</label>
            <input name='_word_upper_bound' type='text' value='$word_upper_bound' id='word_upper_bound' size='5' maxlength='3'
             title='Enter capping value for indexing'
            />
            <p>(Capped at this value depending on the number of times it appears in a page, <br />so that the weighting will not exceed for a page.)</p>
            <p>&nbsp;</p>
            <label for='text_length'>Bound the length of full text indexed at each page:</label>
            <input name='_text_length' type='text' value='$text_length' id='text_length' size='5' maxlength='4'
            title='Enter value for maximum text length indexed at each page'
            />
            <p>(Will limit the indexed keywords to be extracted only from the first part of the full text,<br />
            if set to values like 500 or 1000 characters [0 = unlimited text becomes indexed].</p>
            <p>&nbsp;</p>
            <label for='case_sensitive'>Enable distinct results for upper- and lower-case queries :</label>
            <input name='_case_sensitive' type='checkbox' value='1' id='case_sensitive'
            title='Leave blank for same results'
        ";
    if ($case_sensitive==1) {
        echo " checked='checked'";
    }
    echo" />
            <p>&nbsp;</p>

            <label for='follow_sitemap'>If available follow sitemap.xml : </label>
            <input name='_follow_sitemap' type='checkbox' value='1' id='follow_sitemap'
            title='Select for indexing and reindexing with sitemap.xml'
            ";
    if ($follow_sitemap==1) {
        echo " checked='checked'";
    }
    echo" />
            <label for='create_sitemap'>Create 'sitemap.xml' file of each indexed site : </label>
            <input name='_create_sitemap' type='checkbox' value='1' id='create_sitemap'
            title='Select to create 'sitemap.xml' files in folder .../admin/sitemaps/'
        ";
    if ($create_sitemap==1) {
        echo " checked='checked'";
    }
    echo" />
            <label for='smap_unique'>Use a unique name (sitemap.xml) for all created sitemap files : </label>
            <input name='_smap_unique' type='checkbox' value='1' id='smap_unique'
            title='Select only if all names should be equal'
            ";
    if ($smap_unique==1) {
        echo " checked='checked'";
    }
    echo" />
            <p>(Should be checked only if one single site is to be indexed.<br />
                Do not check if several sites are in the Admin's sites table.<br />
                Otherwise all sitemap files will be overwritten.)</p>

            <label for='utf_16'>Support UTF-16 coded sites : </label>
            <input name='_utf_16' type='checkbox' value='1' id='utf_16'
            title='Select to convert UTF-16 coded sites into UTF-8'
            ";
    if ($utf_16==1) {
        echo " checked='checked'";
    }
    echo" />
            <label for='dummy_001a'>____________________________________________________________________<br /><br /></label>
            <label for='domain_cb'>Crawler can leave domain during index procedure :</label>
            <input name='_domaincb' type='checkbox' value='1' id='domaincb'
            title='Select if the crawler may follow URLs outside the domain'
        ";
    if ($domaincb==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(If activated here, this setting will overwrite the site specific setting)</p>
            <p>&nbsp;</p>
            <label for='use_prefcharset'>Obligatory use the preferred charset for indexing :</label>
            <input name='_use_prefcharset' type='checkbox' value='1' id='use_prefcharset'
            title='Select for indexing with the home charset'
        ";
    if ($use_prefcharset==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(Usually not required, because during index procedure<br />the charset will be detected automatically)</p>

            <label for='depth'>Define indexing depth:</label>
            <input name='_depth' type='text' value='$depth' id='text_length' size='2' maxlength='3'
            title='Enter value for maximum folder depth to be indexed'
            />
            <p>(Enter <strong>-1</strong> for full indexing. Otherweise define<br />count of folder depth to be indexed per site.)</p>

            <label for='dummy_001b'>____________________________________________________________________<br /><br /></label>
            <p>&nbsp;</p>
            <label for='index_numbers'>Index numbers :</label>
            <input name='_index_numbers' type='checkbox' value='1' id='index_numbers'
            title='Select for indexing of numbers in page text'
        ";
    if ($index_numbers==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>&nbsp;</p>
            <label for='index_host'>Index words in Domain Name and URL path :</label>
            <input name='_index_host' type='checkbox'  value='1' id='index_host'
            title='Select to enable domain name and URL path indexing'
        ";
    if ($index_host==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='index_meta_title'>Index the 'Title' Meta tag in HTML header :</label>
            <input name='_index_meta_title' type='checkbox' value='1' id='index_meta_title'
            title='Select to enable indexing of Title tag'
        ";
    if ($index_meta_title==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='index_meta_keywords'>Index the 'Keyword' Meta tag in HTML header :</label>
            <input name='_index_meta_keywords' type='checkbox' value='1' id='index_meta_keywords'
            title='Select to enable indexing of keyword Meta Tag'
        ";
    if ($index_meta_keywords==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='index_meta_description'>Index the 'Description' Meta tag in HTML header :</label>
            <input name='_index_meta_description' type='checkbox' value='1' id='index_meta_description'
            title='Select to enable indexing of Description Meta Tag'
        ";
    if ($index_meta_description==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='ignore_fulltxt'>Do not index the full text :</label>
            <input name='_ignore_fulltxt' type='checkbox' value='1' id='ignore_fulltxt'
            title='Select to enable indexing of itle and all Meta tags'
        ";
    if ($ignore_fulltxt==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will index only the page 'Title', the 'Keywords' Meta tag, as well as the 'Description' Meta tag.)</p>
            <p>&nbsp;</p>
            <label for='index_pdf'>Index .pdf files :</label>
            <input name='_index_pdf' type='checkbox'  value='1' id='index_pdf' title='Select for indexing .pdf files'
         ";
    if ($index_pdf==1) {
        echo " checked='checked'";
    }
    echo "
            />
            ";
    if (function_exists(zip_open)) {
        echo "
                <label for='index_ods'>Index .ods files :</label>
                <input name='_index_ods' type='checkbox'  value='1' id='index_ods' title='Select to index OpenDocumentSpreadsheet files.'
            ";
        if ($index_ods==1) {
            echo " checked='checked'";
        }
        echo "
                />
                <label for='index_odt'>Index .odt files :</label>
                <input name='_index_odt' type='checkbox'  value='1' id='index_odt' title='Select to index OpenDocumentText files.'
            ";
        if ($index_odt==1) {
            echo " checked='checked'";
        }
        echo "
                />
                ";
    }
    echo "
            <label for='index_xls'>Index .xls files :</label>
            <input name='_index_xls' type='checkbox'  value='1' id='index_xls' title='Select to index EXEL .xls files.'
        ";
    if ($index_xls==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='index_csv'>Index .csv files :</label>
            <input name='_index_csv' type='checkbox'  value='1' id='index_csv' title='Select to index .csv files.'
        ";
    if ($index_csv==1) {
        echo " checked='checked'";
    }
    echo "
            />
        ";
    if ($win_os) {
        echo "
                <label for='index_doc'>Index .doc files :</label>
                <input name='_index_doc' type='checkbox'  value='1' id='index_doc' title='Select to index .doc files. Not available for LINUX/UNIX systems.'
            ";
        if ($index_doc==1) {
            echo " checked='checked'";
        }
        echo"
                />
                <label for='index_rtf'>Index .rtf files :</label>
                <input name='_index_rtf' type='checkbox'  value='1' id='index_rtf' title='Select to index .rtf files. Not available for LINUX/UNIX systems.'
            ";
        if ($index_rtf==1) {
            echo " checked='checked'";
        }
/*
//  Currently unsupported, because a failure was detected while converting ppt files > 7 MByte
//  see also    ../include/common/suffix.txt
//  see also    .../admin/spiderfuncs.php
        echo"
                />
                <label for='index_ppt'>Index .ppt files :</label>
                <input name='_index_ppt' type='checkbox'  value='1' id='index_ppt' title='Select to index .ppt files. Not available for LINUX/UNIX systems.'
            ";
        if ($index_ppt==1) {
            echo " checked='checked'";
        }
*/
        echo "
            />

            ";
    }
    if ($gd) {
        echo"
            <label for='dummy_01'>____________________________________________________________________<br /><br /></label>
                <label for='index_image'>Index images like *.gif and *.jpg files :</label>
                <input name='_index_image' type='checkbox'  value='1' id='index_image' title='Select to index image files like .gif and .jpg.'
            ";
        if ($index_image==1) {
            echo " checked='checked'";
        }
        echo"
            />

            <label for='min_image_x'>Define minimum image width (pixels) in order to be indexed :</label>
            <input name='_min_image_x' type='text'  value='$min_image_x' id='min_image_x' size='6' title='Enter min. size in pixels'
            />
            <label for='min_image_y'>Define minimum image height (pixels) in order to be indexed :</label>
            <input name='_min_image_y' type='text'  value='$min_image_y' id='min_image_y' size='6' title='Enter min. size in pixels'
            />
            <p>(Dimensions will be observed for images with the following file suffixes:<br />.bmp .gif .j2c .j2k .jp2 .jpc .jpeg .jpeg2000 .jpg .jpx .png .swc .tif .tiff .wbmp)</p>
            <p>&nbsp;</p>
            ";
    }
    echo"
            <label for='index_audio'>Index audio files like *.wav and *.mp3 streams :</label>
            <input name='_index_audio' type='checkbox'  value='1' id='index_audio' title='Select to index audio files like .wav and .mp3.'
        ";
    if ($index_audio==1) {
        echo " checked='checked'";
    }

    echo"
            />
            <label for='index_video'>Index video files like *.mp4 and *.flv files :</label>
            <input name='_index_video' type='checkbox'  value='1' id='index_video' title='Select to index video files like .mp4 and .flv.'
        ";
    if ($index_video==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='dup_media'>If found on different pages, re-index duplicate media content :</label>
            <input name='_dup_media' type='checkbox'  value='1' id='dup_media' title='Select to re-index duplicate media.'
        ";
    if ($dup_media==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(Automatically activated, if PHP function md5_file() is not available for remote files.)</p>
            <p>&nbsp;</p>
            <label for='ex_media'>Index external hosted media content :</label>
            <input name='_ex_media' type='checkbox'  value='1' id='ex_media' title='Select to index external media linked to by the site being indexed.'
        ";
    if ($ex_media==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='index_embeded'>Also index nested and embeded media files :</label>
            <input name='_index_embeded' type='checkbox'  value='1' id='index_embeded' title='Select to index all objects.'
        ";
    if ($index_embeded==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='index_alt'>Index the 'alt' tag of images and add it as part of the image title:</label>
            <input name='_index_alt' type='checkbox'  value='1' id='index_alt' title='Select to index the alt tag.'
        ";
    if ($index_alt==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='suppress_suffix'>Suppress the file suffix from image file names for indexing:</label>
            <input name='_suppress_suffix' type='checkbox'  value='1' id='suppress_suffix' title='Select to eliminate .jpg .gif etc.'
        ";
    if ($suppress_suffix==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='index_id3'>Index EXIF and ID3 tags for detailed media information :</label>
            <input name='_index_id3' type='checkbox'  value='1' id='index_id3' title='Select to index ID3 tags.'
        ";
    if ($index_id3==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(Will increase the required indexing time.<br />Requires PHP function fopen() for remote files.)</p>
            <label for='dummy_02'>____________________________________________________________________<br /><br /></label>
            <label for='index_rss'>Index RDF, RSD, RSS and Atom feeds :</label>
            <input name='_index_rss' type='checkbox'  value='1' id='index_rss' title='Select to index feeds.'
        ";
    if ($index_rss==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='cdata'>Follow CDATA directives?</label>
            <input name='_cdata' type='checkbox'  value='1' id='cdata' title='Select to obay CDATA tags in feeds, otherwise leave blank.'
        ";
    if ($cdata==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(Select to obey CDATA tags in feeds, otherwise leave blank)</p>
            <label for='dc'>Index 'Dublin Core' and other individually marked tags in RDF feeds :</label>
            <input name='_dc' type='checkbox'  value='1' id='dc' title='Select to index these tags in feeds, otherwise leave blank.'
        ";
    if ($dc==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <p>(Select to index individual tags in RDF feeds, like &lt;dc:title&gt; and &lt;sy:pubDate&gt;)</p>
            <label for='preferred'>Follow the 'preferred (true/false)' directive in RSD feeds :</label>
            <input name='_preferred' type='checkbox'  value='1' id='preferred' title='Select to obay the PREFERRED directive in RSD feeds, otherwise leave blank.'
        ";
    if ($preferred==1) {
        echo " checked='checked'";
    }
    echo"
            />
             <p>(Select to obey the 'preferred' directive in RSD feeds, otherwise leave blank)</p>
            <p>&nbsp;</p>
        ";

    if (function_exists(rar_open)) {   //      if the RAR library is part of the PHP environment
        echo"
            <label for='index_rar'>Index RAR compressed files and archives :</label>
            <input name='_index_rar' type='checkbox'  value='1' id='index_rar' title='Select to index compressed files and archives.'
        ";
        if ($index_rar==1) {
            echo " checked='checked'";
        }
        echo"
            />
        ";
    } else {    //  If RAR library is not available
        $index_rar = 0 ;
    }


    if (function_exists(zip_open)) {   //      if  the ZIP library is part of the PHP environment
        echo"
            <label for='index_zip'>Index ZIP compressed files and archives :</label>
            <input name='_index_zip' type='checkbox'  value='1' id='index_zip' title='Select to index compressed files and archives.'
        ";
        if ($index_zip==1) {
            echo " checked='checked'";
        }
        echo"
            />
        ";
    } else {    //  If ZIP library is not available
        $index_zip = 0 ;
    }

    echo"
            <p>&nbsp;</p>
            <label for='index_framesets'>Index framesets in HTML files :</label>
            <input name='_index_framesets' type='checkbox'  value='1' id='index_framesets' title='Select to index frames.'
        ";
    if ($index_framesets==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='index_iframes'>Index iframes in HTML files :</label>
            <input name='_index_iframes' type='checkbox'  value='1' id='index_iframes' title='Select to index iframes.'
        ";
    if ($index_iframes==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='iframe_link'>Instead of calling page, remember the link to iframe directly :</label>
            <input name='_iframe_link' type='checkbox'  value='1' id='iframe_link' title='Link directly to iframes instead of calling page.'
        ";
    if ($iframe_link==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='abslinks'>Index media content with respect to frame/iframe position :</label>
            <input name='_abslinks' type='checkbox'  value='1' id='abslinks' title='Activate to get all media content related to frame/iframe folder.'
        ";
    if ($abslinks==1) {
        echo " checked='checked'";
    }
    echo"
            />
            <label for='dummy_03'>____________________________________________________________________<br /><br /></label>
            <label for='interval'>Define time interval, when the next periodical Re-index should be done. Every : </label>
            <select name='_interval' id='interval' title='Select time interval for auto re-index'>

            <option value='never'";
    if ($interval == 'never'){
        echo "checked='checked'";
    }
    echo ">never</option>

            <option value='10800'";
    if ($interval == '10800') {
        echo " selected='selected'";
    }
    echo ">3 hours</option>

            <option value='43200'";
    if ($interval == '43200') {
        echo " selected='selected'";
    }
    echo ">12 hours</option>

        <option value='86400'";
    if ($interval == '86400') {
        echo " selected='selected'";
    }
    echo ">1 day</option>

        <option value='604800'";
    if ($interval == '604800') {
        echo " selected='selected'";
    }
    echo ">1 week</option>

        <option value='2419200'";
    if ($interval == '2419200') {
        echo " selected='selected'";
    }
    echo ">1 month</option></select>
            <p>&nbsp;</p>
            <label for='intv_count'>Define count, how often the cyclical Re-indexing should be performed :</label>
            <input name='_intv_count' type='text'  value='$intv_count' id='intv_count' size='6' title='Enter number, how often auto re-index should be done'
            ";

    echo"
            />
            <label for='dummy_03a'>____________________________________________________________________<br /><br /></label>
            <label for='use_common'>Use 'commonlist' for words to be ignored during index / re-index&nbsp;&nbsp;<br />Select language of the 'common words' list that should be used : </label>
            <select name='_use_common' id='use_common' title='Select which language is to be used'>

            <option value='none'";
    if ($use_common == 'none'){
        echo "checked='checked'";
    }
    echo ">none</option>

            <option value='ar'";
    if ($use_common == 'ar') {
        echo " selected='selected'";
    }
    echo ">Arabic</option>

            <option value='bn'";
    if ($use_common == 'bn') {
        echo " selected='selected'";
    }
    echo ">Bengali</option>

        <option value='bg'";
    if ($use_common == 'bg') {
        echo " selected='selected'";
    }
    echo ">Bulgarian</option>

        <option value='ca'";
    if ($use_common == 'ca') {
        echo " selected='selected'";
    }
    echo ">Catalan</option>

        <option value='cn'";
    if ($use_common == 'cn') {
        echo " selected='selected'";
    }
    echo ">Chinese</option>

            <option value='ru'";
    if ($use_common == 'ru') {
        echo " selected='selected'";
    }
    echo ">Cyrillic</option>

        <option value='cz'";
    if ($use_common == 'cz') {
        echo " selected='selected'";
    }
    echo ">Czech</option>

            <option value='dk'";
    if ($use_common == 'dk') {
        echo " selected='selected'";
    }
    echo ">Danish</option>

            <option value='nl'";
    if ($use_common == 'nl') {
        echo " selected='selected'";
    }
    echo ">Dutch</option>

            <option value='en'";
    if ($use_common == 'en') {
        echo " selected='selected'";
    }
    echo ">English</option>

            <option value='ir'";
    if ($use_common == 'ir') {
        echo " selected='selected'";
    }
    echo ">Farsi</option>

        <option value='fi'";
    if ($use_common == 'fi') {
        echo " selected='selected'";
    }
    echo ">Finnish</option>

            <option value='fr'";
    if ($use_common == 'fr') {
        echo " selected='selected'";
    }
    echo ">French</option>

            <option value='de'";
    if ($use_common == 'de') {
        echo " selected='selected'";
    }
    echo ">German</option>

            <option value='el'";
    if ($use_common == 'el') {
        echo " selected='selected'";
    }
    echo ">Greek</option>

             <option value='hi'";
    if ($use_common == 'hi') {
        echo " selected='selected'";
    }
    echo ">Hindi</option>

             <option value='hu'";
    if ($use_common == 'hu') {
        echo " selected='selected'";
    }
    echo ">Hungarian</option>

            <option value='it'";
    if ($use_common == 'it') {
        echo " selected='selected'";
    }
    echo ">Italian</option>

            <option value='no'";
    if ($use_common == 'no') {
        echo " selected='selected'";
    }
    echo ">Norwegian</option>

            <option value='pl'";
    if ($use_common == 'pl') {
        echo " selected='selected'";
    }
    echo ">Polish</option>

            <option value='pt'";
    if ($use_common == 'pt') {
        echo " selected='selected'";
    }
    echo ">Portuguese</option>

            <option value='ro'";
    if ($use_common == 'ro') {
        echo " selected='selected'";
    }
    echo ">Romanian</option>

            <option value='es'";
    if ($use_common == 'es') {
        echo " selected='selected'";
    }
    echo ">Spanish</option>

            <option value='se'";
    if ($use_common == 'se') {
        echo " selected='selected'";
    }
    echo ">Swedish</option>

            <option value='tr'";
    if ($use_common == 'tr') {
        echo " selected='selected'";
    }
    echo ">Turkish</option>

            <option value='all'";
    if ($use_common == 'all') {
        echo " selected='selected'";
    }
    echo ">Use all lists</option></select>

            <p>&nbsp;</p>
            <label for='use_white1'>Use whitelist in order to index / re-index only those pages<br />that include <strong>any</strong> of the words in whitelist :</label>
            <input name='_use_white1' type='checkbox'  value='1' id='use_white1' title='Select to index only pages including one of the words in whitelist.'
        ";
    if ($use_white1==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='use_white2'>Use whitelist in order to index / re-index only those pages<br />that include <strong>all</strong> the words in whitelist :</label>
            <input name='_use_white2' type='checkbox'  value='1' id='use_white2' title='Select to index only pages including all the words in whitelist.'
        ";
    if ($use_white2==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='use_black'>Use blacklist to prevent index / re-index of pages<br />that contain <strong>any</strong> of the words in blacklist :</label>
            <input name='_use_black' type='checkbox'  value='1' id='use_black' title='Select to not index pages including any of the words in blacklist.'
        ";
    if ($use_black==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='kill_query'>Use blacklist to delete queries<br />that contain any of the words in blacklist :</label>
            <input name='_kill_query' type='checkbox'  value='1' id='kill_query' title='Select to kill queries including any of the words in blacklist.'
        ";
    if ($kill_query==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='not_divs'>Use list of div ids to ignore the div content during index/re-index :</label>
            <input name='_not_divs' type='checkbox'  value='1' id='not_divs' title='Select to ignore those divs.'
        ";
    if ($not_divs==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='use_divs'>Use list of div ids to index only the div content during index/re-index :</label>
            <input name='_use_divs' type='checkbox'  value='1' id='use_divs' title='Select to index only those divs.'
        ";
    if ($use_divs==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='not_elems'>Use list of HTML elements to ignore the element content during index/re-index :</label>
            <input name='_not_elems' type='checkbox'  value='1' id='not_elems' title='Select to ignore those elements.'
        ";
    if ($not_elems==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='use_elems'>Use list of HTML elements to index only the element content during index/re-index :</label>
            <input name='_use_elems' type='checkbox'  value='1' id='use_elems' title='Select to index only those elemts.'
        ";
    if ($use_elems==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='del_elems'>Besides the usual HTML elements &lt;<strong>element</strong>&gt; , also delete from full text <br />all those HTML elements, which are defined like<strong> & l t ; element & g t ; </strong>:</label>
            <input name='_del_elems' type='checkbox'  value='1' id='del_elems' title='Select to delete those elemts.'
        ";
    if ($del_elems==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Attention: this option may delete parts of the full text, </br>if&nbsp;&nbsp;<strong>& l t ;</strong>&nbsp;&nbsp;and&nbsp;&nbsp;<strong>& g t ;</strong>&nbsp;&nbsp;are used as smaller and larger signs in full text.</p>
            <p>&nbsp;</p>
            <label for='conv_puny'>Convert punycode URLs like http://xn--90aoqlh7c4a.xn--d1abbgf6aiiy.xn--p1ai/ <br />found in full text into the readable form http://события.президент.рф/ :</label>
            <input name='_conv_puny' type='checkbox' id='conv_puny' value='1' title='Select to convert punycode in full text'
        ";
    if ($conv_puny==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='stem_lang'>Use word stemming. Stem algorithm will work language specific.<br />Select the language to be stemmed : </label>
            <select name='_stem_words' id='stem_words' title='Select which language is to be stemmed'>
            <option value='none'";
    if ($stem_words == 'none'){
        echo "checked='checked'";
    }
    echo ">none</option>

            <option value='bg'";
    if ($stem_words == 'bg') {
        echo " selected='selected'";
    }
    echo ">Bulgarian</option>

        <option value='cn'";
    if ($stem_words == 'cn') {
        echo " selected='selected'";
    }
    echo ">Chinese</option>

            <option value='ru'";
    if ($stem_words == 'ru') {
        $use_common == 'ru';
        echo " selected='selected'";
    }
    echo ">Cyrillic</option>

            <option value='cz'";
    if ($stem_words == 'cz') {
        echo " selected='selected'";
    }
    echo ">Czech</option>

            <option value='nl'";
    if ($stem_words == 'nl') {
        echo " selected='selected'";
    }
    echo ">Dutch</option>

            <option value='en'";
    if ($stem_words == 'en') {
        echo " selected='selected'";
    }
    echo ">English</option>

            <option value='fi'";
    if ($stem_words == 'fi') {
        echo " selected='selected'";
    }
    echo ">Finnish</option>

            <option value='fr'";
    if ($stem_words == 'fr') {
        echo " selected='selected'";
    }
    echo ">French</option>

            <option value='de'";
    if ($stem_words == 'de') {
        echo " selected='selected'";
    }
    echo ">German</option>

            <option value='el'";
    if ($stem_words == 'el') {
        echo " selected='selected'";
    }
    echo ">Greek</option>

            <option value='hu'";
    if ($stem_words == 'hu') {
        echo " selected='selected'";
    }
    echo ">Hungarian</option>

            <option value='it'";
    if ($stem_words == 'it') {
        echo " selected='selected'";
    }
    echo ">Italian</option>

            <option value='pt'";
    if ($stem_words == 'pt') {
        echo " selected='selected'";
    }
    echo ">Portuguese</option>

            <option value='es'";
    if ($stem_words == 'es') {
        echo " selected='selected'";
    }
    echo ">Spanish</option>

            <option value='se'";
    if ($stem_words == 'se') {
        echo " selected='selected'";
    }
    echo ">Swedish</option></select>
            <p>For English text e.g. find sites containing 'runs' and 'running' when searching for 'run'.<br />If stemming of languages should not be used, select 'none'.</p>
            <p>&nbsp;</p>
            <label for='strip_sessids'>Strip session ids from links found during index procedure:</label>
            <input name='_strip_sessids' type='checkbox'  value='1' id='strip_sessids' title='Select to enable session ID stripping'
        ";
    if ($strip_sessids==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Independent from upper and lower case spelling, the following sessions will be destroyed:<br />PHPSESSID, JSESSIONID, session_id, ASPSESSIONID, sid, zenid</p>
            <label for='strip_s_sessids'>In addition to above session ids, also destroy <strong>s</strong> as a session id:</label>
            <input name='_strip_s_sessids' type='checkbox'  value='1' id='strip_s_sessids' title='Select to enable session ID stripping for character s'
        ";
    if ($strip_s_sessids==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(If activated, also something like <strong>?s=6&p=32</strong> will be interpreted as a session id)</p>
            <p>&nbsp;</p>
            <label for='other_host'>Allow other hosts with same domain name for all links<br />found during indexing. Also ignore TLD, SLD and www.</label>
            <input name='_other_host' type='checkbox'  value='1' id='other_host' title='Select to follow all links of a domain name'
        ";
    if ($other_host==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='redir_host'>Allow indexing other hosts with same domain name but only&nbsp;&nbsp;<br />if the found links are redirected. Also ignore TLD, SLD and www.</label>
            <input name='_redir_host' type='checkbox'  value='1' id='redir_host' title='Select to follow all links of a domain name'
        ";
    if ($redir_host==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='cano_leave'>Crawler can leave domain during index procedure,&nbsp;<br /> but only for canonical links.</label>
            <input name='_cano_leave' type='checkbox'  value='1' id='cano_leave' title='Select to follow all anonical clinks, also outside of the domain'
        ";
    if ($cano_leave==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='js_reloc'>Follow URL redirections, which are invoked by JavaScript :</label>
            <input name='_js_reloc' type='checkbox'  value='1' id='js_reloc' title='Select to follow redirections.'
        ";
    if ($js_reloc==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Will obey directives, which are found at the beginning of the file contents like:&nbsp;</br />&lt;SCRIPT language=\"javascript\"&gt;window.location=\"mp.php?mcv=59\";&lt;/SCRIPT&gt;</p>

            <label for='dup_path'>Delete duplicate parts of the URL path found in the calling URL and the new links :</label>
            <input name='_dup_path' type='checkbox'  value='1' id='dup_path' title='Select to kill these duplicates.'
        ";
    if ($dup_path==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Unfortunately some CMS seem to be unable to build up a correct path for relative links.<br />If activated, these duplicate parts of the path will be deleted from the link URL.<br />Should be activated only, if sites are indexed created by  dedicated CMS. </p>




            <label for='dummy_03b'>____________________________________________________________________<br /><br /></label>

            <label for='only_docs'>Index only files and documents as defined in docs list :</label>
            <input name='_only_docs' type='checkbox'  value='1' id='only_docs' title='Select to follow all links, but index only special files'
        ";
    if ($only_docs==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(If activated, all pages of the site will be searched for links, <br />but only files with suffixes as defined in the docs list will become indexed.)</p>
            <p>&nbsp;</p>
            <label for='only_links'>Index only links and their titles :</label>
            <input name='_only_links' type='checkbox'  value='1' id='only_links' title='Select to follow all links and index only their titles'
        ";
    if ($only_links==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(If activated, full text will not be indexed but only the titles of all links)</p>
            <p>&nbsp;</p>
            <label for='link_check'>Perform a link-check instead of re-index : </label>
            <input name='_link_check' type='checkbox'  value='1' id='link_check' title='Select for link-check'
        ";
    if ($link_check==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(leave blank for standard re-index)</p>
        ";
    echo "
            <p>&nbsp;</p>
            <label for='dup_content'>Enable index and re-index for pages with duplicate content : </label>
            <input name='_dup_content' type='checkbox'  value='1' id='dup_content' title='Select to index pages with content already indexed with other pages'
        ";
    if ($dup_content==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(leave blank if pages with duplicate content should not be indexed)<br /><br /></p>
        ";

    echo "
            <label for='div_all'>Split words into their basic parts, separated at each hyphen, quote, dot and comma :</label>
            <input name='_div_all' type='checkbox'  value='1' id='div_all' title='Activate for complete word splitting.'
        ";
    if ($div_all==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(For example 'sphider-plus.eu' will be split into the 3 keywords:&nbsp;&nbsp;sphider&nbsp;&nbsp;plus&nbsp;&nbsp;eu<br />Additionally, the original will be stored, so that all 4 words become searchable.)<br /><br /></p>
        ";

    echo "
            <label for='div_hyphen'>Split words into their basic parts, separated only at hyphens :</label>
            <input name='_div_hyphen' type='checkbox'  value='1' id='div_hyphen' title='If prices etc. should remain unsplit select this option.'
        ";
    if ($div_hyphen==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(For example 'sphider-plus.eu' will be split into the 2 keywords:&nbsp;&nbsp;sphider&nbsp;&nbsp;plus.eu<br />Additionally, the original will be stored, so that all 3 words become searchable.)<br /><br /></p>
        ";

    echo "
            <label for='del_secchars'>Delete special characters like dots, commas,<br />exclamation and question marks etc. as first and last letter of words :</label>
            <input name='_del_secchars' type='checkbox'  value='1' id='del_secchars' title='Select to delete special characters and index only the pure words.'
        ";
    if ($del_secchars==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Symbols like ( and \" in front of words and also . , ) : ! ? as final characters<br />of words are deleted. So only the pure words will be indexed.)</p>

            <label for='del_seccharin'>Delete special characters inside of words:</label>
            <input name='_del_seccharin' type='checkbox'  value='1' id='del_seccharin' title='Select to delete special characters inside of words and index only the pure words.'
        ";
    if ($del_seccharin==1) {
        echo " checked='checked'";
    }
    echo "
            />
             <p>(Underscores, hyphens and symbols like&nbsp;&nbsp;<strong>'&nbsp; ・&nbsp;&nbsp;/&nbsp;&nbsp;\"</strong><br />as part of words are deleted. So only the pure words will be indexed.)</p>
            <p>&nbsp;</p>
            <label for='quotes'>Convert all kind of single quotes like `&nbsp;´&nbsp;&nbsp;’&nbsp;&nbsp;‘&nbsp;&nbsp;into standard quotes ' : </label>
            <input name='_quotes' type='checkbox'  value='1' id='quotes' title='Select to convert all kind of single quotes into standard quotes'
        ";
    if ($quotes==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='dup_quotes'>Convert all kind of double quotes like <strong>“&nbsp;&nbsp;”</strong> and <strong>„</strong> into standard quotes <strong>\"</strong> : </label>
            <input name='_dup_quotes' type='checkbox'  value='1' id='dup_quotes' title='Select to convert all kind of double quotes into standard quotes'
        ";
    if ($dup_quotes==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='vowels'>Convert all kind of accents like á,&nbsp;ç,&nbsp;ê,&nbsp;ì,&nbsp;ü,&nbsp;into their basic vowels :<br /> Implemented for the upper and lower case vowels:  a, c, e, i, o, and u. </label>
            <input name='_vowels' type='checkbox'  value='1' id='vowels' title='Select to convert letters with accents to the basic letter'
        ";
    if ($vowels==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Will present the same query results, when searching for café as well as for cafe, <br />but will not be obeyed for 'strict' and 'phrase' search.)<br /><br /></p>
            <p>&nbsp;</p>
            <label for='bb_decode'>Enable to decode BBCode into standard HTML : </label>
            <input name='_bb_decode' type='checkbox'  value='1' id='bb_decode' title='Select to decode BBCode'
        ";
    if ($bb_decode==1) {
        echo " checked='checked'";
    }
    echo "
            />
             <p>( If selected, code like <strong>[url=http://abc.de/][b]abc.de[/b][/url]</strong> <br />will be converted to <strong>&lt;a href=\"http://abc.de\"&gt;&lt;strong&gt;abc.de&lt;/strong&gt;&lt;/a&gt;</strong> )</p>
             <p>&nbsp;</p>

            <label for='ent_decode'>Enable to decode entity coded sites into standard HTML characters : </label>
            <input name='_ent_decode' type='checkbox'  value='1' id='ent_decode' title='Select to decode Entities'
        ";
    if ($ent_decode==1) {
        echo " checked='checked'";
    }
    echo "
            />
             <p>( If selected, text like <strong>& # 268 ; apek and D & ouml ; hl</strong> <br />will be converted to <strong>&#268;apek and D&ouml;hl</strong> )</p>
            <label for='dummy_04'>____________________________________________________________________<br /><br /></label>
            <label for='greek'>Support Greek language : </label>
            <input name='_greek' type='checkbox'  value='1' id='greek' title='Select to support Greek language'
        ";
    if ($greek==1) {
        echo " checked='checked'";
    }
    echo "
            />
        ";
    if ($_mb == '1') {
        echo "
            <label for='noacc_el'>Convert all kind of Greek accents into their basic vowels:&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <input name='_noacc_el' type='checkbox' value='1' id='noacc_el'
            title='If selected, queries in Greek language do not need any vowel accents '
        ";
        if ($noacc_el==1) {
            echo " checked='checked'";
        }
        echo "
            />
            <p>Will present the same query results, when searching with the letter<strong> α </strong>as well as using: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br ><strong>ἀ, ἁ, ἂ, ἃ, ἄ, ἅ, ἆ, ἇ, ὰ, ά, ά, ᾀ, ᾁ, ᾂ, ᾃ, ᾄ, ᾅ, ᾆ, ᾇ, ᾰ, ᾱ, ᾲ, ᾳ, ᾴ, ᾶ or ᾷ</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />The same behaviour for the other Greek vowels <strong>ε, η, ι, ω, ο, υ, and ρ</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /> Implemented for upper and lower case vowels, but will not be obeyed for 'strict' and 'phrase' search.&nbsp;&nbsp;&nbsp;&nbsp;</p>

            <label for='translit_el'>Transliterate queries with Latin characters into their Greek equivalents :&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <input name='_translit_el' type='checkbox' value='1' id='translit_el'
            title='Select to convert ASCII characters into Greek characters'
        ";
        if ($translit_el==1) {
            echo " checked='checked'";
        }
        echo "
            />
            <p>Will transform the query input <strong>alla</strong> to find <strong>ἀλλὰ</strong>&nbsp;&nbsp;and <strong>baptismatos</strong> to find <strong>βαπτίσματος</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />Will not be obeyed for 'strict' search.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
        ";
    }
    echo"
            <p>&nbsp;</p>
            <label for='cyrillic'>Support Cyrillic languages : </label>
            <input name='_cyrillic' type='checkbox'  value='1' id='cyrillic' title='Select to support languages using the Cyrillic alphabet'
        ";
    if ($cyrillic==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='cn_seg'>Perform a segmentation of Chinese text : </label>
            <input name='_cn_seg' type='checkbox'  value='1' id='cn_seg' title='Select to segment Chinese words during index / re-index'
        ";
    if ($cn_seg==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Will divide phrases like 帽子和服装 into the base words 帽子 and 和 and 服装 ,<br />so all will become searchable.<br />Available for Chinese sites with charset: GB18030, GB2312 and GBK<br />as well as for Korean sites with charset: EUC-KR and ISO10646-1933</p>
            <p>&nbsp;</p>
            <label for='jp_seg'>Perform a segmentation of Japanese text : </label>
            <input name='_jp_seg' type='checkbox'  value='1' id='jp_seg' title='Select to segment Japanese words during index / re-index'
        ";
    if ($jp_seg==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>Available for Japanese sites with charset: Shift_JIS, EUC-JP and UTF-8</p>
            <label for='dummy_05'>____________________________________________________________________<br /><br /></label>
            <label for='dummy0'>Index .htaccess password protected sites</label>
            <input name='_dummy0' value='' type='hidden' id='dummy0'
            />
            <p>Up to 3 different zones / areas could be registered.</p>
            <p>If not desired, set 'Username' and 'Password' to 0</p>
            <label for='dummy1'>Zone 1</label>
            <input name='_dummy1' value='' type='hidden' id='dummy1'
            />
             <label for='user1'>'Username' for protected pages :</label>
            <input name='_user1' value='$user1' type='text' id='user1' size='20'
            title='Enter username 1 here'
            />

            <label for='pwd1'>'Password' for protected pages :</label>
            <input name='_pwd1' value='$pwd1' type='text' id='pwd1' size='20'
            title='Enter password 1 here'
            />
            <p>&nbsp;</p>

            <label for='dummy2'>Zone 2</label>
            <input name='_dummy2' value='' type='hidden' id='dummy2'
            />
            <label for='user2'>'Username' for protected pages :</label>
            <input name='_user2' value='$user2' type='text' id='user2' size='20'
            title='Enter username 2 here'
            />

            <label for='pwd2'>'Password' for protected pages :</label>
            <input name='_pwd2' value='$pwd2' type='text' id='pwd2' size='20'
            title='Enter password 2 here'
            />
            <p>&nbsp;</p>
            <label for='dummy3'>Zone 3</label>
            <input name='_dummy3' value='' type='hidden' id='dummy3'
            />

            <label for='user3'>'Username' for protected pages :</label>
            <input name='_user3' value='$user3' type='text' id='user3' size='20'
            title='Enter username 3 here'
            />

            <label for='pwd3'>'Password' for protected pages :</label>
            <input name='_pwd3' value='$pwd3' type='text' id='pwd3' size='20'
            title='Enter password 3 here'
            />
            <p>&nbsp;</p>
            <label for='dummy_s3'>______________________________<br /><br /></label>
            <label for='submit'>Save all Settings :</label>
            <input class='sbmt' type='submit' value='Save' id='submit3' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            <fieldset><legend><a name=\"set_5\">[ Search Settings ]</a></legend>
            <br /><br />
            <label for='results_per_page'>Default search results per page :</label>
            <input type= 'radio' name='_results_per_page' value='10' title='Select default results per search page'
        ";
    if ($results_per_page==10) {
        echo " checked='checked'";
    }
    echo "
            />10<br />
            <input class='ltfloat' type='radio' name='_results_per_page' id='results_per_page' value='20'
        ";
    if($results_per_page==20) {
        echo " checked='checked'";
    }
    echo "
            />20 <br />
            <input class='ltfloat' type='radio' name='_results_per_page' value='30'
        ";
    if($results_per_page==30) {
        echo " checked='checked'";
    }
    echo "
            />30 <br />
            <input class='ltfloat' type='radio' name='_results_per_page' value='50'
        ";
    if ($results_per_page==50) {
        echo " checked='checked'";
    }
    echo "
            />50<br /><br />
            <label for='language'>Language for Result Page : </label>
            <select name='_language' id='language' title='Select your preferred Search Page language'>
            <option value='en'
        ";
    if ($language == 'en'){
        echo " checked='checked'";
    }
    echo ">English</option>

            <option value='ar'";
    if ($language == 'ar') {
        echo " selected='selected'";
    }
    echo ">Arabic</option>

            <option value='bg'";
    if ($language == 'bg') {
        echo " selected='selected'";
    }
    echo ">Bulgarian</option>

            <option value='hr'";
    if ($language == 'hr') {
        echo " selected='selected'";
    }
    echo ">Croatian</option>

            <option value='cns'";
    if ($language == 'cns') {
        echo " selected='selected'";
    }
    echo ">Simple Chinese</option>

            <option value='cnt'";
    if ($language == 'cnt') {
        echo " selected='selected'";
    }
    echo ">Traditional Chinese</option>

            <option value='cz'";
    if ($language == 'cz') {
        echo " selected='selected'";
    }
    echo">Czech</option>

            <option value='dk'";
    if ($language == 'dk') {
        echo " selected='selected'";
    }
    echo ">Danish</option>

            <option value='nl'";
    if ($language == 'nl') {
        echo " selected='selected'";
    }
    echo ">Dutch</option>

            <option value='en'";
    if ($language == 'en') {
        echo " selected='selected'";
    }
    echo ">English</option>

            <option value='ee'";
    if ($language == 'ee') {
        echo " selected='selected'";
    }
    echo ">Estonian</option>

            <option value='fi'";
    if ($language == 'fi') {
        echo " selected='selected'";
    }
    echo ">Finnish</option>

            <option value='fr'";
    if ($language == 'fr') {
        echo " selected='selected'";
    }
    echo ">French</option>
            <option value='de'";

    if ($language == 'de') {
        echo " selected='selected'";
    }
    echo ">German</option>

            <option value='he'";
    if ($language == 'he') {
        echo " selected='selected'";
    }
    echo ">Hebrew</option>

            <option value='hu'";
    if ($language == 'hu') {
        echo " selected='selected'";
    }
    echo ">Hungarian</option>

            <option value='it'";
    if ($language == 'it') {
        echo " selected='selected'";
    }
    echo ">Italian</option>

            <option value='jp'";
    if ($language == 'jp') {
        echo " selected='selected'";
    }
    echo ">Japanese</option>

            <option value='lv'";
    if ($language == 'lv') {
        echo " selected='selected'";
    }
    echo ">Latvian</option>

            <option value='no'";
    if ($language == 'no') {
        echo " selected='selected'";
    }
    echo ">Norwegian (nynorsk)</option>

            <option value='nn'";
    if ($language == 'nn') {
        echo " selected='selected'";
    }
    echo ">Norwegian (bokmål)</option>

            <option value='pl'";
    if ($language == 'pl') {
        echo " selected='selected'";
    }
    echo ">Polish</option>

            <option value='pt'";
    if ($language == 'pt') {
        echo " selected='selected'";
    }
    echo ">Portuguese</option>

            <option value='ro'";
    if ($language == 'ro') {
        echo " selected='selected'";
    }
    echo ">Romanian</option>

            <option value='ru'";
    if ($language == 'ru') {
        echo " selected='selected'";
    }
    echo ">Russian</option>

            <option value='sr'";
    if ($language == 'sr') {
        echo " selected='selected'";
    }
    echo ">Serbian</option>

            <option value='sk'";
    if ($language == 'sk') {
        echo " selected='selected'";
    }
    echo ">Slovak</option>

            <option value='si'";
    if ($language == 'si') {
        echo " selected='selected'";
    }
    echo ">Slovenian</option>
            <option value='es'";
    if ($language == 'es') {
        echo " selected='selected'";
    }
    echo ">Spanish</option>

            <option value='se'";
    if ($language == 'se') {
        echo " selected='selected'";
    }
    echo ">Swedish</option>

            <option value='tr'";
    if ($language == 'tr') {
        echo " selected='selected'";
    }
    echo ">Turkish</option></select>

            <label for='auto_lng'>Automatically detect users dialog language :</label>
            <input name='_auto_lng' type='checkbox' value='1' id='auto_lng'
            title='Select to enable the automatic detection of user dialog language'
            ";
    if ($auto_lng==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='kill_black_uas'>Block all queries sent by harvester, bots and known evil user-agents:</label>
            <input name='_kill_black_uas' type='checkbox' id='kill_black_uas' value='1' title='Select, if you want to reduce server traffic and CPU load.'
        ";
    if ($kill_black_uas == 1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='kill_black_ips'>Block all queries sent by Meta search engines like Google, MSN, Amazon, etc.:</label>
            <input name='_kill_black_ips' type='checkbox' id='kill_black_ips' value='1' title='Select, if you want to reduce server traffic and CPU load.'
        ";
    if ($kill_black_ips == 1) {
        echo " checked='checked'";
    }
    echo "
            />

            <label for='block_attacks'>Block all queries, which could cause an XSS attack, Shell execution, Tag inclusion, <br />or a JavaScript execution:</label>
            <input name='_block_attacks' type='checkbox' id='block_attacks' value='1' title='Select, to supress the according query input.'
        ";
    if ($block_attacks == 1) {
        echo " checked='checked'";
    }
    echo "
            />

             <p>&nbsp;</p>
            <label for='use_cache'>Enable result caching :</label>
            <input name='_use_cache' type='checkbox' value='1' id='use_cache'
            title='Select to find results first in Cache memory'
            ";
    if ($use_cache==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='tcache_size'>Define size of Cache for Text Results [MByte] :</label>
            <input name='_tcache_size' type='text' id='tcache_size' size='3' maxlength='3' value='$tcache_size'
            title='Enter value to define RAM size used for temporary storage of search results for text'
            />
            <label for='mcache_size'>Define size of Cache for Media Results [MByte] :</label>
            <input name='_mcache_size' type='text' id='mcache_size' size='3' maxlength='3' value='$mcache_size'
            title='Enter value to define RAM size used for temporary storage of search results for media'
            />
            <label for='max_ctresults'>Define max. number of results (links) per query stored in text cache :</label>
            <input name='_max_ctresults' type='text' id='max_ctresults' size='3' maxlength='4' value='$max_ctresults'
            title='Enter value to define how many links=results per query-input should be stored in text cache.'
            />
            <label for='max_cmresults'>Define max. number of results (links) per query stored in media cache :</label>
            <input name='_max_cmresults' type='text' id='max_cmresults' size='3' maxlength='4' value='$max_cmresults'
            title='Enter value to define how many links=results per query-input should be stored in media cache.'
            />
            <label for='clear_cache'>Clear Cache during Re-index procedure : </label>
            <input name='_clear_cache' type='checkbox' value='1' id='clear_cache'
            title='Select to delete text and media results from cache during re-index'
            ";
    if ($clear_cache==1) {
        echo " checked='checked'";
    }

    echo "
            />        <p>&nbsp;</p>
            <label for='title'>Title for Result Page :</label>
            <input name='_mytitle' type='text' id='mytitle' value='$mytitle' size='42' maxlength='60'
            title='Enter your personal Title for Result Page'
            />
            <label for='mark'>Select method of highlighting for found keywords in result listing : </label>
            <select name='_mark' id='mark' title='Select highlighting for found keywords in result listing'>
            <option value='markbold'";
    if ($mark == 'markbold'){
        echo " checked='checked'";
    }
    echo ">bold text</option>

            <option value='markred'";
    if ($mark == 'markred') {
        echo " selected='selected'";
    }
    echo ">red text</option>

            <option value='markyellow'";
    if ($mark == 'markyellow') {
        echo " selected='selected'";
    }
    echo ">marked yellow</option>
            <option value='markgreen'";
    if ($mark == 'markgreen') {
        echo " selected='selected'";
    }
    echo ">marked green</option>
            <option value='markblue'";
    if ($mark == 'markblue') {
        echo " selected='selected'";
    }
    echo ">marked blue</option></select>
            <p>&nbsp;</p>
            <label for='bound_search_results'>Bound number of search results :</label>
            <input name='_bound_search_result' type='text' value='$bound_search_result' id='bound_search_results' size='5'
            title='Change to limit total search results found - 0 = unlimited'
            />
            <p>(Can speed up searches on large database - 0 = unlimeted results)</p>
            <p>&nbsp;</p>
            <label for='links_to_next'>Number of links shown to \"Next\" pages :</label>
            <input name='_links_to_next' type='text' value='$links_to_next' id='links_to_next' size='5' maxlength='2'
            title='Enter default number of \"Next\" page links to display'
            />
            <p>&nbsp;</p>
            <label for='elapsed'>Show the elapsed time (to fetch the results) in result header :</label>
            <input name='_elapsed' type='checkbox' value='1' id='elapsed'
            title='Select to show the time consumed to get all results from the database'
        ";

    if ($elapsed==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <div class='clear'></div>
            <p>&nbsp;</p>
            <label for='show_meta_description'>Show 'Description' Meta Tag (if it exists) on results page :</label>
            <input name='_show_meta_description' type='checkbox' value='1' id='show_meta_description'
            title='Select to enable display of the content of description meta tag. If it doesn't exist, the full text will be displayed'
        ";

    if ($show_meta_description==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <div class='clear'></div>
            <p>(Otherwise show an extract from the page text)</p>
            <label for='show_warning'>Show warning message if query was not found in full text;&nbsp;&nbsp;<br />but only in 'Title' of page, 'Keywords' 'Meta tags' or 'URL' :</label>
            <input name='_show_warning' type='checkbox' value='1' id='show_warning'
            title='Select to enable the warning message'
        ";

    if ($show_warning==1) {
        echo " checked='checked'";
    }

    echo "
            />
            <p>&nbsp;</p>
            <label for='advanced_search'>Advanced search (Shows 'AND/OR/PHRASE/TOLERANT/MEDIA' etc.) :</label>
            <input name='_advanced_search' type='checkbox'  value='1' id='advanced_search'
            title='Select to enable \"Advanced Search\" in Search Box'
        ";

    if ($advanced_search==1) {
        echo " checked='checked'";
    }
    echo "
            />

            <label for='show_categories'>Show category selection in search form :</label>
            <input name='_show_categories' type='checkbox' value='1' id='show_categories'
            title='Select to display Categories on results pages'
        ";

    if ($show_categories==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='more_catres'>If available, user may select 'More results of category . . . '<br />at each result in results listing' :</label>
            <input name='_more_catres' type='checkbox' value='1' id='more_catres'
            title='Select for user definition of more results from any valid category'
        ";

    if ($more_catres==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>&nbsp;</p>
            <label for='show_res_num'>Show the actual result number for each result:</label>
            <input name='_show_res_num' type='checkbox' value='1' id='show_res_num'
            title='Select to enable display Result numbers'
        ";
    if ($show_res_num==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='show_query_scores'>Show result scores (weighting % or hit counts in full text)<br />calculated by Sphider-plus :</label>
            <input name='_show_query_scores' type='checkbox' value='1' id='show_query_scores'
            title='Select to enable display of Result Scores'
        ";
    if ($show_query_scores==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='show_res_url'>Show the URL of each result in a separate row :</label>
            <input name='_show_res_url' type='checkbox' value='1' id='show_res_url'
            title='Select to enable display of result URL'
        ";
    if ($show_res_url==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Required to be activated also for displaying the weight / hit-count of each result)</p>
            <p>&nbsp;</p>
            <label for='no_quotes'>Reduce queries containing quotes to the basic word :</label>
            <input name='_no_quotes' type='checkbox' value='1' id='no_quotes'
            title='Select to enable display of hits in fulltext'
        ";

    if ($no_quotes==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>This will deliver the same results for queries like: <br /><strong>d'information</strong> = <strong>information</strong>
            or <strong>dei'largi</strong> = <strong>largi</strong></p>
            <p>(Will be automatically disabled, if query contains more than one word.)</p>

            <p>&nbsp;</p>


            <label for='wild_num'>For queries containing numbers, search with wildcards :</label>
            <input name='_wild_num' type='checkbox' value='1' id='wild_num'
            title='Select to search with wildcards for queries with numbers'
        ";

    if ($wild_num==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <p>(Useful to search for complex article numbers,<br />if the user only knows a part of the complete item description.)</p>
            <p>&nbsp;</p>
            <label for='title_length'>Maximum length of page title displayed in search results :</label>
            <input name='_title_length' type='text' id='title_length' size='5' maxlength='4' value='$title_length'
            title='Enter value to limit maximum number of characters for page title in result listing'
            />
            <p>(Title will be broken at the end of the word exceeding the defined length)</p>
            <label for='desc_length'>Maximum length of page summary displayed in search results :</label>
            <input name='_desc_length' type='text' id='desc_length' size='5' maxlength='4' value='$desc_length'
            title='Enter value to limit maximum number of characters for page summaries in result listing'
            />
            <label for='url_length'>Maximum length of URL displayed in search results :</label>
            <input name='_url_length' type='text' id='url_length' size='5' maxlength='4' value='$url_length'
            title='Enter value to limit maximum number of characters of URL in result listing'
            />
            <p>&nbsp;</p>
            <label for='max_hits'>Define maximum count of result hits per page, displayed in search results:<br /> (if multiple occurrence of keyword is available in different passages of the full text)</label>
            <input name='_max_hits' type='text' id='max_hits' size='1' maxlength='1' value='$max_hits'
            title='Enter value to limit maximum number of shown hits per page in result listing'
            />
            <p>&nbsp;</p>
            <label for='did_you_mean_enabled'>Enable spelling suggestions (Did you mean?) :</label>
            <input name='_did_you_mean_enabled' type='checkbox' value='1' id='did_you_mean_enabled'
            title='Select to enable \"Did You Mean?\" suggestions on results page'
        ";

    if ($did_you_mean_enabled==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='dummy_06'>____________________________________________________________________<br /><br /></label>
            <label for='show_media'>In addition to text results, also show media results in result listing : </label>
            <input name='_show_media' type='checkbox' value='1' id='show_media'
            title='Select to enable media results displayed in result pages'
        ";

    if ($show_media==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='limit_media'>Limit the amount of media results presented together with text results to :</label>
            <input name='_limit_media' type='text' id='limit_media' size='3' maxlength='3' value='$limit_media'
            title='Enter value to limit the amount of media results'
            />
            <p>(Defined as maximum count of media results per page)</p>
            <label for='search_id3'>Find media results not only by file name and media title, but also by EXIF and ID3 info : </label>
            <input name='_search_id3' type='checkbox' value='1' id='search_id3'
            title='Select to show media results extracted also from ID3 and EXIF info'
        ";

    if ($search_id3==1) {
        echo " checked='checked'";
    }
    echo "
            />

            <label for='sort_media'>Define the default chronological order for media result listing : </label>
            <select name='_sort_media' id='sort_media' title='Select how to present the media result listing'>

            <option value='1'";
    if ($sort_media == '1'){
        echo " checked='checked'";
    }
    echo ">By title (alphabetic)</option>

            <option value='2'";
    if ($sort_media == '2'){
        echo " selected='selected'";
    }
    echo ">By image size </option>

            <option value='3'";
    if ($sort_media == '3') {
        echo " selected='selected'";
    }
    echo ">By 'Last queried'</option>

            <option value='4'";
    if ($sort_media == '4') {
        echo " selected='selected'";
    }
    echo ">By 'Most popular'</option>

            <option value='5'";
    if ($sort_media == '5') {
        echo " selected='selected'";
    }
    echo ">By file suffix</option></select>

            <label for='dummy_07'>____________________________________________________________________<br /><br /></label>
            <label for='show_sort'>Show mode of chronological order for result listing as additional headline :</label>
            <input name='_show_sort' type='checkbox' value='1' id='show_sort'
            title='Select to display the chronological order for results pages'
        ";

    if ($show_sort==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='sort_results'>Define the default chronological order for text result listing : </label>
            <select name='_sort_results' id='sort_results' title='Select how to present the result listing'>

            <option value='1'";
    if ($sort_results == '1'){
        echo " checked='checked'";
    }
    echo ">By relevance (weight %) </option>

            <option value='7'";
    if ($sort_results == '7'){
        echo " selected='selected'";
    }
    echo ">By hit counts in full text </option>

            <option value='5'";
    if ($sort_results == '5') {
        echo " selected='selected'";
    }
    echo ">'Most Popular Links' on top</option>

            <option value='6'";
    if ($sort_results == '6') {
        echo " selected='selected'";
    }
    echo ">By index date</option>

        <option value='2'";
    if ($sort_results == '2') {
        echo " selected='selected'";
    }
    echo ">Main URLs (domains) on top </option>

            <option value='3'";
    if ($sort_results == '3') {
        echo " selected='selected'";
    }
    echo ">By URL names</option>

            <option value='4'";
    if ($sort_results == '4') {
        echo " selected='selected'";
    }
    echo ">Like Google (Top 2 per URL)</option></select>
            <p>&nbsp;</p>
            <label for='dom_count'>For result sorting <strong>'By URL names'</strong> define number&nbsp;&nbsp;<br />of results shown per domain in result listing :</label>
            <input name='_dom_count' type='text' id='dom_count' size='2' maxlength='2' value='$dom_count'
            title='Enter maximal count in result listing for each domain'
            />
            <p>(Leave blank in order to present all results.)&nbsp;&nbsp;</p>
            <p>&nbsp;</p>
            <label for='relevance'>Define min. relevance level (weight in % or hit counts in full text)&nbsp;&nbsp;<br /> for results to be presented in result listing : </label>
            <input name='_relevance' type='text' id='relevance' size='3' maxlength='2' value='$relevance'
            title='Enter 0 to get all results.'
            />
        ";
    echo "
            <label for='max_results'>Define max. amount of results presented in result listing : </label>
            <input name='_max_results' type='text' id='max_results' size='3' maxlength='6' value='$max_results'
            title='Enter 999999 to get all results.'
            />
        ";
    echo "
            <p>(Will also be used as limit, if 'Bound database' is invoked)</p>
            <label for='db_content'>Show the count of sites, links, categories and keywords&nbsp;&nbsp;<br />of currently active User database at the bottom of result listing : </label>
            <input name='_db_content' type='checkbox' value='1' id='db_content'
            title='Select to show a summary of user active db.'
        ";

    if ($db_content==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='dummy_08'>____________________________________________________________________<br /><br /></label>
            <label for='most_pop'>Show 'Most popular searches' at the bottom of result pages : </label>
            <input name='_most_pop' type='checkbox' value='1' id='most_pop'
            title='Select to enable Most popular searches displayed at the bottom of result pages'
        ";

    if ($most_pop==1) {
        echo " checked='checked'";
    }

    echo "
            />
            <label for='no_zeros'>Suppress zero results in 'Most popular searches' : </label>
            <input name='_no_zeros' type='checkbox' value='1' id='no_zeros'
            title='Select to hide all searches, which did not cause a result.'
        ";

    if ($no_zeros==1) {
        echo " checked='checked'";
    }
    echo "
            />
            <label for='pop_rows'>Define count of queries shown in 'Most popular searches' (max. 20) : </label>
            <input name='_pop_rows' type='text' id='pop_rows' size='2' maxlength='2' value='$pop_rows'
            title='If selected above, define here how many query hits should be presented.'
            />
         ";
    //
    /*
     echo "
     <label for='tag_cloud'>In order to present 'Most popular searches', use rotating 3D tag cloud instead of table : </label>
     <input name='_tag_cloud' type='checkbox' value='1' id='tag_cloud'
     title='Select to use a 3D moving tag cloud.'
     ";

     if ($tag_cloud==1) {
     echo " checked='checked'";
     }
     echo "
     />
     <label for='color_cloud'>Present 3D tag cloud with different colors for each query hit : </label>
     <input name='_color_cloud' type='checkbox' value='1' id='color_cloud'
     title='Select to colorize the 3D moving tag cloud.'
     ";

     if ($color_cloud==1) {
     echo " checked='checked'";
     }
     echo "
     />
     ";
     */
    //
    echo "
            <label for='dummy_09'>____________________________________________________________________<br /><br /></label>
            <label for='add_url'>Allow user to suggest a URL to be indexed :</label>
            <input name='_add_url' type='checkbox' value='1' id='add_url'
            title='Select to enable User may suggest a new Url,displayed at the bottom of result pages'
        ";
    if ($add_url==1) {
        echo " checked='checked'
        ";
    }

    echo "
            />
            <label for='captcha'>Captcha protection for URL Submission Form :</label>
            <input name='_captcha' type='checkbox' value='1' id='captcha'
            title='Select for user security input when suggesting a new URL'
        ";
    if ($captcha==1) {
        echo " checked='checked'
        ";
    }
    echo "
            />

            <label for='addurl_info'>Inform about user suggestion by e-mail :</label>
            <input name='_addurl_info' type='checkbox' value='1' id='addurl_info'
            title='Select to enable e-mail notification for user suggestion of new URLs'
        ";
    if ($addurl_info==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />

            <label for='add_auth'>Suggested sites require authentication tags :</label>
            <input name='_add_auth' type='checkbox' value='1' id='add_auth'
            title='Select for user security input when suggesting a new URL'
        ";
    if ($add_auth==1) {
        echo " checked='checked'
        ";
    }
    echo "
            />
            <p>(Authentication will become valid for next index prodedure)</p>

            <label for='whois_user'>Perform a WHOIS check for suggested URLs,<br />so that not registered domains will be rejected automatically:</label>
            <input name='_whois_user' type='checkbox' value='1' id='whois_user'
            title='Select to enable a domain check for suggested URLs'
        ";
    if ($whois_user==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <label for='whois_admin'>Enable a WHOIS output for suggested URLs in Admin backend :</label>
            <input name='_whois_admin' type='checkbox' value='1' id='whois_admin'
            title='Select to enable a domain check for only for the Admin'
        ";
    if ($whois_admin==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />

            <label for='whois_ext'>Use the extended list of accepted suffixes for suggested URLs :</label>
            <input name='_whois_ext' type='checkbox' value='1' id='whois_ext'
            title='Select for extended list of accepted suffixes'
        ";
    if ($whois_ext==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <p><strong>If activated, the following suffixes will be accepted: </strong></p>
            <p>.ac .ae .aero .ag .al .am .as .asia .at .au .az .ba .be .bg .bi .biz .bj .br .bt .by .bz&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.ca .cat .cc .cd .ch .ci .ck .cl .cn .com .coop .cx .cy .cz .de .dk .dm .dz .edu .ee .eg .es .eu&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.fi .fo .fr .gb .gd .ge .gg .gi .gl .gm .gov .gr .gs .gy .hk .hm .hn .hr .hu&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.ie .il .in .info .int .io .iq .ir .is .it .je .jobs .jp .ke .kg .kr .kz .la .li .lt .lu .lv .ly&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.ma .mc .md .me .mg .mn .mobi .ms .mt .mu .museum .mx .my .na .name .net .nf .nl .no .nu .nz&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.org .pl .pm .pr .pro .pt .re .ro .ru .sa .sb .sc .se .sg .sh .si .sk .sm .st .su&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.tc .tel .tf .th .tk .tl .tm .tn .to .tp .tr .travel .tv .tw&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.ua .ug .uk .us .uy .uz .va .vc .ve .vg .wf .ws .yt .yu&nbsp;&nbsp;&nbsp;&nbsp;</p>

            <p><strong>Otherwise only the following gTLD and some important country codes will be accepted:</strong></p>
            <p>.aero .asia .biz .cat .cn .com .coop .de .edu .es .eu .fr .gov .info .int .it&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>.jobs .me .mobi .museum .name .net .org .pro .tel .travel .tv .uk .us&nbsp;&nbsp;&nbsp;&nbsp;</p>
            <p>&nbsp;</p>

            <label for='dummy_s4'>______________________________<br /><br /></label>
            <label for='submit'>Save all Settings :</label>
            <input class='sbmt' type='submit' value='Save' id='submit22' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            <fieldset><legend><a name=\"set_6\">[ Suggest Options ]</a></legend>
            <p>&nbsp;</p>
            <label for='min_sug_chars'>Define minimum count of query letters in order to get a suggestion :</label>
            <input name='_min_sug_chars' type='text' id='min_sug_chars' size='1' maxlength='1' value='$min_sug_chars'
            title='Enter minimum number of characters for suggestions to be presented'
            />
            <p>( 0 = No suggestion will be presented)</p>
            <label for='dummy_10'>______________________________<br /><br /></label>
            <label for='suggest_history'>Search for suggestions in query log :</label>
            <input name='_suggest_history' type='checkbox' value='1' id='suggest_history'
            title='Select to enable suggestions from Query Log'
        ";
    if ($suggest_history==1) {
        echo " checked='checked'
            ";
    }
    echo"
            />
            <label for='suggest_keywords'>Search for suggestions in keywords :</label>
            <input name='_suggest_keywords' type='checkbox' value='1' id='suggest_keywords'
            title='Select to enable suggestions from Keywords'
        ";
    if ($suggest_keywords==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <label for='suggest_phrases'>Build suggestions also for 'Phrase' search :</label>
            <input name='_suggest_phrases' type='checkbox' value='1' id='suggest_phrases'
            title='Select to enable suggestions from Phrases'
        ";
    if ($suggest_phrases==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <label for='suggest_id3'>For 'Media' search get suggestions also from EXIF info and ID3 tags :</label>
            <input name='_suggest_id3' type='checkbox' value='1' id='suggest_id3'
            title='Select to enable suggestions from EXIF and ID3 info'
        ";
    if ($suggest_id3==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <label for='show_hits'>Show amount of found keywords in suggestion table :</label>
            <input name='_show_hits' type='checkbox' value='1' id='show_hits'
            title='Select to show result hits in database'
        ";
    if ($show_hits==1) {
        echo " checked='checked'
            ";
    }
    echo "
            />
            <label for='suggest_rows'>Limit number of suggestions to :</label>
            <input name='_suggest_rows' type='text' id='suggest_rows' size='3' maxlength='2' value='$suggest_rows'
            title='Enter default number of rows for suggestions'
            />
            <p>&nbsp;</p>
            <label for='dummy_s5'>______________________________<br /><br /></label>
            <label for='submit'>Save all Settings :</label>
            <input class='sbmt' type='submit' value='Save' id='submit1' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            <fieldset><legend><a name=\"set_7\">[ Page Indexing Weights ]</a></legend><br />
            <p class='warnadmin sml'>If you modify any settings in this section after first index, you are obliged to invoke</p>
            <p class='warnadmin sml'>'Erase &amp; Re-index'.</p>
            <p>&nbsp;</p>

            <label for='title_weight'>Relative weight of a word in web page Title tag :</label>
            <input name='_title_weight' type='text' id='title_weight' size='5' maxlength='2' value='$title_weight'
            title='Enter default weight for words in a Web page title tag'
            />
            <label for='domain_weight'>Relative weight of a word in the Domain Name :</label>
            <input name='_domain_weight' type='text' id='domain_weight' size='5' maxlength='2' value='$domain_weight'
            title='Enter default weight for words in a Domain Name'
            />
            <label for='path_weight'>Relative weight of a word in the Path Name :</label>
            <input name='_path_weight' type='text' id='path_weight' size='5' maxlength='2' value='$path_weight'
            title='Enter default weight for words in a Path Name'
            />
            <label for='meta_weight'>Relative weight of a word in web page Keywords tag :</label>
            <input name='_meta_weight' type='text' id='meta_weight' size='5' maxlength='2' value='$meta_weight'
            title='Enter default weight for words in Keyword Meta Tags'
            />
            ";
    /*
     <label for='domain_mul'>Multiplier for words in main URLs (domains): </label>
     <input name='_domain_mul' type='text' id='domain_mul' size='1' maxlength='1' value='$domain_mul'
     title='Defines factor for all words in Domains.'
     />
     */
    echo"
            <p>&nbsp;</p>
            <label for='dompromo'>Name of promoted domain :</label>
            <input name='_dompromo' type='text' id='dompromo' size='25' maxlength='25' value='$dompromo'
            title='Enter name of domain to be promoted as most top results'
            />
            <p>Enter name of domain to be promoted as 'on top' in search result listing.<br />Leave blank if no domain should be privileged.</p>
            <label for='keypromo'>Promoted catchword in text :</label>
            <input name='_keypromo' type='text' id='keypromo' size='25' maxlength='25' value='$keypromo'
            title='Enter catchword to be promoted as most top results'
            />
            <p>If this word is found in full text, title, etc. of a page to be indexed,<br />this link will be promoted as 'on top' in search result listing.<br />Leave blank if no catchword should be privileged.</p>
            <p>&nbsp;</p>

            <input class='hide' type='hidden' name='f' value='settings'
            />
            <input class='hide' type='hidden' name='Submit' value='1'
            />

            <input class='hide' type='hidden' name='_plus_nr' value='$plus_nr'
            />
            <input class='hide' type='hidden' name='_version_nr' value='$version_nr'
            />
            <input class='hide' type='hidden' name='_mb' value='$mb'
            />
            <input class='hide' type='hidden' name='_ids_warn' value='$ids_warn'
            />
            <input class='hide' type='hidden' name='_ids_stop' value='$ids_stop'
            />
            <label for='dummy_s6'>______________________________<br /><br /></label>
            <label for='submit'>Save all Settings:</label>
            <input class='sbmt' type='submit' value='Save' id='submit01' title='Click once to save these settings'
            />
            <div class='clear'></div>
            <a class='navup' href='admin.php?f=settings' title='Jump to Page Top'>Top</a>
            </fieldset>
            <br />
            </form>

            </div><br />
            ";
?>