Location: PHPKode > projects > Sphider Plus > sphider-plus_v.2.9/addurl.php
<?php
    error_reporting(E_ALL );
    define("_SECURE",1);    // define secure constant

    $admin_dir 		= "./admin";
    $include_dir 	= "./include";
    $template_dir 	= "./templates";
    $settings_dir 	= "./settings";
    $language_dir 	= "./languages";

    require_once	("$settings_dir/database.php");

    //      get active database
    if ($dbs_act == '1') {
        $db_con     = db1_con() ;
        $mysql_table_prefix = $mysql_table_prefix1;
    }

    if ($dbs_act == '2') {
        $db_con = db2_con() ;
        $mysql_table_prefix = $mysql_table_prefix2;
    }

    if ($dbs_act == '3') {
        $db_con = db3_con() ;
        $mysql_table_prefix = $mysql_table_prefix3;
    }

    if ($dbs_act == '4') {
        $db_con = db4_con() ;
        $mysql_table_prefix = $mysql_table_prefix4;
    }

    if ($dbs_act == '5') {
        $db_con = db5_con() ;
        $mysql_table_prefix = $mysql_table_prefix5;
    }

    $def_config = '';
    $plus_nr    = '';
    @include "".$settings_dir."/db".$dbs_act."/conf_".$mysql_table_prefix.".php";
    if (!$plus_nr) {
        $def_config = '1';
        include "/settings/backup/Sphider-plus_default-configuration.php";
    }

    if ($debug == '0') {
        if (function_exists("ini_set")) {
            ini_set("display_errors", "0");
        }
        error_reporting(0);  //     suppress  PHP messages
    }

    $result = '';
    if ($use_ids == 1 && $def_config != 1){ // if Intrusion Detection System should be used
        require_once ("$include_dir/ids_handler.php");
    }


    require_once	("$include_dir/searchfuncs.php");
    require_once	("$include_dir/categoryfuncs.php");
    require_once    ("$include_dir/commonfuncs.php");

    $date           = strftime("%d.%m.%Y");                                 //      Format for date
    $time           = date("H:i");                                          //      Format for time
    $mailer         = "$mytitle Addurl-mailer";                             //      Name of mailer
    $subject1       = "A new site suggestion arrived for Sphider-plus";     //      Subject for administrator e-mail when a new suggestion arrived
    $category_id    = '';
    $B1             = '';
    $authent        = 'not yet defined';

    if ($auto_lng == 1) {   //  if enabled in Admin settings, get country code of calling client
        if ( isset ( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) {
            $cc = substr( htmlspecialchars($_SERVER['HTTP_ACCEPT_LANGUAGE']), 0, 2);
            $handle = @fopen ("$language_dir/$cc-language.php","r");
            if ($handle) {
                $language = $cc; // if available set language to users slang

            }
            else {
                include "$language_dir/$language-language.php";
            }
            @fclose($handle);
        }
        else {
            include "$language_dir/$language-language.php";
        }
    }
    require_once    ("$language_dir/$language-language.php");

    extract(getHttpVars());

    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
        <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
        <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
        <head>
            <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
            <title>$mytitle. Suggest a new site</title>
            <meta name=\"public\" content=\"all\" />
            <link rel='stylesheet' type='text/css' href='$template_dir/$template/userstyle.css' />
            <script type=\"text/javascript\">
                function getObject(obj) {
                  var theObj;
                  if(document.all) {
                    if(typeof obj==\"string\") {
                      return document.all(obj);
                    } else {
                      return obj.style;
                    }
                  }
                  if(document.getElementById) {
                    if(typeof obj==\"string\") {
                      return document.getElementById(obj);
                    } else {
                      return obj.style;
                    }
                  }
                  return null;
                }
                function charCounter(input,output,texto,characters) {
                  var inputObj=getObject(input);
                  var outputObj=getObject(output);
                  var longitud=characters - inputObj.value.length;
                  if(longitud <= 0) {
                    longitud=0;
                    texto='<span class=\"warnadmin\">'+texto+'</span>';
                    inputObj.value=inputObj.value.substr(0,characters);
                  } else {
                    texto='<span class=\"em evrow\">'+texto+'</span>';
                  }
                  outputObj.innerHTML = texto.replace(\"{CHAR}\",longitud);
                }
            </script>
        </head>
        <body>
        ";

    //IDS detected an attack?
    if (strlen($result) > 13 && $def_config != 1) {
        //  get impact of intrusion
        $len = strpos($result, "<")-13;
        $res = trim(substr($result, '1', $len));
        if ($res >= $ids_warn) {
            echo "
                    <br /><br />
                    <div class='headline cntr'>
                        IDS result message
                    </div>
                    <br /><br />
                    $result
                    <br />
                    <div class='cntr warnadmin'>
                        <br />
                        Further input blocked by the Sphider-plus supervisor, because the
                        <br /><br />
                        Intrusion Detection System noticed the above attempt to attack this search engine.
                        <br /><br />
                    </div>
                    <div class='headline cntr'>
                    &nbsp;
                    </div>
                    <br /><br />
                </body>
            </html>
                ";
                    die();
        }
    }

    //  already known as an eval IP by the IDS ?
    if ($ids_blocked == 1 && $def_config != 1) {
        $blocked = '';
        if ( isset ( $_SERVER['REMOTE_ADDR'] ) ) {      //  get actual IP from user
            $new_ip = htmlspecialchars($_SERVER['REMOTE_ADDR']);
            $handle = @fopen ("$include_dir/IDS/tmp/phpids_log.txt","r");
            if ($handle) {      //      read IDS log-file
                $lines = @file("$include_dir/IDS/tmp/phpids_log.txt");
                @fclose($handle);
            }

            foreach ($lines as $thisline) {                             //  analyze all stored intrusion attempts
                preg_match("@\"(.*?)\",(.*?),(.*?),@",$thisline, $regs);
                if ($new_ip == $regs[1] && $regs[3] >= $ids_stop) {     //  if actual IP is known to be eval and impact was significant
                    $blocked = '1';
                }
            }

            if ($blocked) {
                echo "
                        <br /><br />
                        <div class='headline cntr'>
                            IDS message: known eval IP due to former attacks
                        </div>
                        <br /><br />
                        <div class='cntr warnadmin'>
                            <br />
                            Further access blocked by the Sphider-plus supervisor, because the
                            <br /><br />
                            Intrusion Detection System already noticed an attempt to attack this search engine.
                            <br /><br />
                        </div>
                        <div class='headline cntr'>
                        &nbsp;
                        </div>
                        <br /><br />
                    </body>
                </html>
                    ";
                die();
            }
        }
    }

    if ($B1 == $sph_messages['submit']) {

        if($captcha == 1) {     // if Admin selected, evaluate Captcha
            error_reporting(E_ERROR);
            session_start();

            if ($_SESSION['CAPTCHAString'] != $_POST['captchastring']){
                echo "  <h1>$mytitle</h1><br />
                    <p class='em cntr warnadmin'>
                    ".$sph_messages['invalidCaptcha']."
                    <br />
                    </p>
                    <br />
                    <a class='bkbtn' href='addurl.php' title='Go back to Suggest form'>".$sph_messages['BackToSubForm']."</a>
                </body>
            </html>
                    ";
                die ('');
            }

            if ($debug == '0') {
                error_reporting(0);  //     suppress  PHP messages
            } else {
                error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
            }
            session_destroy();
        }
        
        // 	clean input
        $url 		= 	cleaninput(cleanup_text(trim(substr ($url, 0,1024))));
        $title 		= 	cleaninput(cleanup_text(trim(substr ($title, 0,255))));
        $description = 	cleaninput(cleanup_text(nl2br(trim(substr ($description, 0,255)))));
        $email 		= 	cleaninput(cleanup_text(trim(substr ($email, 0,255))));

        //	check URL
        if($whois_user) {   //  perform a WHOIS check for suggested URL

            require_once "$include_dir/domain_whois.php";

            $list       = "";
            $whois      = new whois();  //new class
            $whois_res  = $whois->lookup($url, $whois_ext, $list);
            unset($whois);

            $whois_server   = $whois_res['whoisserver'];
            $whois_result   = $whois_res['result'];
            $whois_answer   =  $whois_res['answer'];

            if ($whois_result != "okay") {
                echo "  <h1>$mytitle</h1>
                            <p>&nbsp;<p>
                            <p class='warnadmin cntr'><br />Invalid URL input. <br />$whois_answer<br /><br /></p>
                            <p>&nbsp;</p>
                            <a class='bkbtn' href='addurl.php' title='Go back to Submission Form'>Back</a></p>
                        </body>
                    </html>
                        ";
                die ('');

            }
        } else {
            if (!$idna) {   //  if not accepted internationalized URLs, do a standard check
                $input  = $url;
                validate_url($input);
                $url = $input;
            } else {
                require_once "$include_dir/idna_converter.php";
                // Initialize the converter class
                $IDN = new idna_convert(array('idn_version' => 2008));
                // The input string, if input is not UTF-8 or UCS-4, it must be converted before
                //$input = utf8_encode($url);
                // Encode it to its punycode presentation
                $punycode_url = $IDN->encode($url);

                $regex = "=(https?|ftp)://[a-z0-9]([a-z0-9-]*[a-z/0-9])?\.[a-z0-9]=i";

                if(!preg_match($regex, $punycode_url)) {
                    echo "<br />
                            <p>&nbsp;<p>
                            <p class='warnadmin cntr'><br />Invalid URL input. <br />$url<br /><br /></p>
                            <p>&nbsp;</p>
                            <a class='bkbtn' href='addurl.php' title='Go back to Submission Form'>Back</a></p>
                            </body>
                            </html>
                        ";
                    exit;
                }
            }
        }

        //	check Title input
        if(strlen($title) < 5 || strlen($title) > 100) {
            echo "  <h1>$mytitle</h1>
                    <p>&nbsp;<p>
                    <p class='em cntr warnadmin'><br />
                    ".$sph_messages['InvTitle']."
                    <br /><br />
                    </p>
                    <p>&nbsp;<p>
                    <a class='bkbtn' href='addurl.php' title='Go back to Suggest form'>".$sph_messages['BackToSubForm']."</a>
                </body>
            </html>
                ";
            die ('');
        }

        //	check Description input
        if(strlen($description) < 5 || strlen($description) > 100) {
            echo "  <h1>$mytitle</h1>
                    <p>&nbsp;<p>
                    <p class='em cntr warnadmin'><br />
                    ".$sph_messages['InvDesc']."
                    <br /><br />
                    </p>
                    <p>&nbsp;<p>
                    <a class='bkbtn' href='addurl.php' title='Go back to Suggest form'>".$sph_messages['BackToSubForm']."</a>
                </body>
            </html>
                ";
            die ('');
        }

        //	check e-mail account
        $input  = $email;
        validate_email($input);
        $email = $input;

        //	Is the new URL banned ?
        $res = 0;
        $Burl = 0;
        $Bquery = "SELECT * FROM ".$mysql_table_prefix."banned LIMIT 0 , 30000";
        $Bresult = mysql_query($Bquery);
        if ($debug > '0') echo mysql_error();

        if (mysql_num_rows($Bresult) <> '') {
            while ($Brow = mysql_fetch_array($Bresult)) {

                if (!strpos($url, $Brow['domain'])) {
                    $Burl = 0;
                } else {
                    $Burl = 1;
                    echo "  <h1>$mytitle</h1>
                            <p>&nbsp;<p>
                            <p class='em'>
                            Sorry to tell you.<br />
                            But the site you suggested is banned from this search engine.<br />
                            We will not index that site.<br />
                            </p>
                            <p>&nbsp;<p>
                            <a class='bkbtn' href='$search_script' title='Go back to Sphider-plus'>Back to Sphider-plus</a>
                        </body>
                    </html>
                        ";
                    die();
                }
            }
        } else { $Burl = 0; }

        //	suggested URL is already indexed?
        $new_url = 0;
        $query = "SELECT * FROM ".$mysql_table_prefix."sites where url like '%$url%'";
        $result = mysql_query($query);
        if ($debug > '0') echo mysql_error();

        if (mysql_num_rows($result) <> '') {
            $new_url = 0;
            echo "  <h1>$mytitle</h1>
                    <p>&nbsp;<p>
                    <p class='em'>
                    Thank you for your suggestion.<br />
                    But the suggested site is already indexed by this search engine.<br />
                    </p>
                    <p>&nbsp;<p>
                    <a class='bkbtn' href='$search_script' title='Go back to Sphider-plus'>Back to Sphider-plus</a>
                </body>
            </html>
                ";
            die();
        }

        //	check if new URL was already suggested before
        $new_url = 0;
        $query = "SELECT * FROM ".$mysql_table_prefix."addurl LIMIT 0 , 300";
        $result = mysql_query($query);
        if ($debug > '0') echo mysql_error();

        if (mysql_num_rows($result) <> '') {
            while ($row = mysql_fetch_array($result)) {
                if ($url != $row['url']){
                    $new_url = 1;
                } else {
                    $new_url = 0;
                    echo "  <h1>$mytitle</h1>
                                <p>&nbsp;<p>
                                <p class='em'>
                                Thank you for your suggestion.<br />
                                But this Url was already suggested by someone else before.<br />
                                </p>
                                <p>&nbsp;<p>
                                <a class='bkbtn' href='$search_script' title='Go back to Sphider-plus'>Back to Sphider-plus</a>
                            </body>
                        </html>
                        ";
                    die();
                }
            }
        } else {
            $new_url = 1;
        }

        if ($new_url == 1) {
            //	Time to store all into database and output a thanks for suggestion
            mysql_query("INSERT INTO ".$mysql_table_prefix."addurl (url, title, description, category_id, account, authent)
                                                            VALUES ('".$url."', '".$title."', '".$description."', '".$category_id."', '".$email."', '".$authent."')");
            if ($debug > '0') echo mysql_error();

            echo "  <h1>$mytitle</h1>
                    <p>&nbsp;<p>
                    <p class='em'>
                    Thank you very much.<br />
                    We will check your suggestion " .$url. " within the next future.<br />
                    If the new site fulfills all requirements of this search engine, it will be indexed shortly.<br />
                    About our decission we will inform you by e-mail.<br />
                    Thanks again for your effort.<br />
                    </p>
                    <p>&nbsp;<p>
                    <a class='bkbtn' href='$search_script' title='Go back to Sphider-plus'>Back to Sphider-plus</a>
                ";

            //	Finally inform the administrator about the new suggestion
            $title  = str_replace ('\\','',$title);			//	recover title
            $title	= str_replace ('&quot','"',$title);

            $description	= str_replace ('\\','',$description);   //	recover description
            $description	= str_replace ('&quot','"',$description);
            $cat ='';

            if ($category_id != 0) {
                $query = "SELECT * FROM ".$mysql_table_prefix."categories WHERE category_id = $category_id";
                $result = mysql_query($query);
                if ($debug > '0') echo mysql_error();
                mysql_close();

                $cat ='';
                if ($result !=0) {
                    $row = mysql_fetch_array($result);
                    $cat = $row['category'];            //      fetch name of category
                }
            }
            $header = "from: $mailer<".$dispatch_email.">\r\n";
            $header .= "Reply-To: ".$dispatch_email."\r\n";
            $subject1    = "A new site suggestion arrived for Sphider-plus";  //  Subject for e-mail to administrator when suggestion arrived

            if ($addurl_info == 1) { //  should we inform the admin by e-mail?
                //      Text for e-mail to administrator when suggestion arrived
                $text1 = "On $date at $time a new site was suggested!\n
    The following dates were submitted:\n\n
    URL           : $url\n
    Titel         : $title\n
    Description   : $description\n
    Category      : $cat\n
    E-mail account: $email\n\n
    This mail was automatically generated by: $mailer.\n\n";

                if (mail($admin_email,$subject1,$text1,$header) or die ("<br /><br /><br />Error to inform the administrator of this site ( $admin_email )<br /><br />Never the less your data was stored on our database.<br /><br />They will be checked within the next future.<br /><br />About the result you will be informed as soon as possible by e-mail.<br /><br />"));
            }
        }
    } else {    //  Here we start the output of the Submission form


        //      get active database
        if ($dbu_act == '1') {
            $db_con     = db1_connect() ;
            $mysql_table_prefix = $mysql_table_prefix1;
        }

        if ($dbu_act == '2') {
            $db_con = db2_connect() ;
            $mysql_table_prefix = $mysql_table_prefix2;
        }

        if ($dbu_act == '3') {
            $db_con = db3_connect() ;
            $mysql_table_prefix = $mysql_table_prefix3;
        }

        if ($dbu_act == '4') {
            $db_con = db4_connect() ;
            $mysql_table_prefix = $mysql_table_prefix4;
        }

        if ($dbu_act == '5') {
            $db_con = db5_connect() ;
            $mysql_table_prefix = $mysql_table_prefix5;
        }

        echo "    <h1> $mytitle<br /><br />".$sph_messages['SubForm']."</h1>
            <br />
            <div class=\"cntr\">
                <p class='advsrch'>".$sph_messages['SubmitHeadline']."</p>
                <p class='advsrch'>( ".$sph_messages['AllFields']." ! )</p>
                <br />
                <div class='panel w75'>
                    <form  class='txt' name='add_url' action='addurl.php'  method='post'>
                        <table  class='searchBox'>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr >
                                <td class='em evrow'>".$sph_messages['New_url']."</td>
                                <td><input type='text' name='url' value='http://' size='60' maxlength='100' /></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class='em evrow'>".$sph_messages['Title']."</td>
                                <td><input type='text' name='title' id='title' size='60' maxlength='100' onkeyup=\"charCounter('title','titleComplete','<br />&nbsp;&nbsp;".$sph_messages['still']." {CHAR} ".$sph_messages['charLeft']."&nbsp;&nbsp;',100);\" /><div id='titleComplete' class='cntr bd'><span class='em evrow' ><br />&nbsp;&nbsp;".$sph_messages['still']." 100 ".$sph_messages['charLeft']."&nbsp;&nbsp;</span></div></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class='em evrow'>".$sph_messages['Description']."</td>
                                <td><textarea wrap='physical' class='farbig'  rows='5' cols='43' name='description' id='description' onkeyup=\"charCounter('description','descriptionComplete','<br />&nbsp;&nbsp;".$sph_messages['still']." {CHAR} ".$sph_messages['charLeft']."&nbsp;&nbsp;',250);\"></textarea><div id='descriptionComplete' class='cntr bd'><span class='em evrow' ><br />&nbsp;&nbsp;".$sph_messages['still']." 250 ".$sph_messages['charLeft']."&nbsp;&nbsp;</span></div></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
            ";

        if($show_categories =='1') {     // if Admin selected, show categories
            echo "          <tr>
                                <td class='em evrow'>".$sph_messages['Category']."</td>
                                <td><select name=\"category_id\" size=\"1\">
                ";

            list_categories (0, 0, "white", "","");
                echo "      </select>
                                </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                </tr>
                ";
        }

        echo "                <tr>
                                <td class='em evrow'>".$sph_messages['Account']."</td>
                                <td><input type='text' name='email' size='60' maxlength='100' value='hide@address.com' /></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
            ";

        if($captcha == 1) {     // if Admin selected, show Captcha
            echo "                <tr>
                                <td class='em evrow'>".$sph_messages['enterCaptcha']."</td>
                                <td>
                                    <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='$include_dir/make_captcha.php?.png' name='capimage' alt='Captcha' border='1' />
                                    <br /><br />
                                    <input type='text' name='captchastring' size='28' value='' />
                                    <br /><br />
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td></td>
                            </tr>
                ";
        }
        $submit = $sph_messages['submit'];
        echo "                <tr>
                                <td  class='em evrow'></td>
                                <td><input class='submit-button' type='submit' value='$submit' name='B1' /><br /><br /></td>
                            </tr>
                        </table>
                    </form>
                </div>
                <br />
                ";
    }

    footer();

    echo "
            </div>
        </body>
    </html>
        ";

    function list_categories($parent, $lev, $color, $message, $category_id) {
        global $mysql_table_prefix, $debug, $db_con;

        if ($lev == 0) {
            print "\n";
        }
        $space = "";
        $id = "";
        for ($x = 0; $x < $lev; $x++)
        $space .= "&nbsp;&nbsp;&nbsp;-&nbsp;";

        $query = "SELECT * FROM ".$mysql_table_prefix."categories  ORDER BY category LIMIT 0 , 300";
        $result = mysql_query($query);
        if ($debug > '0') echo mysql_error();

        if (mysql_num_rows($result) <> '') {
            print "<option ".$selected." value=\"0\">&nbsp;&nbsp;none</option>\n";  //select no category
            while ($row = mysql_fetch_array($result)) {
                $id = $row['category_id'];
                $cat = $row['category'];
                $selected = " selected ";
                if ($category_id != $id) { $selected = ""; }
                print "<option ".$selected." value=\"".$id."\">".$space.stripslashes($cat)."</option>\n";
            }
        } else {    //      if no category has been created up to now
            print "<option ".$selected." value=\"".$id."\">".$space.stripslashes($cat)."</option>\n";
        }
        return ;
    }

    function db1_con() {
        global $mysql_host1, $mysql_user1, $mysql_password1, $database1;

        $db_con1 = @mysql_pconnect ($mysql_host1, $mysql_user1, $mysql_password1);
        if (!$db_con1) {
            echo "<p><span class='red'>&nbsp;Mysql Server for database '$database1' not available!&nbsp;<br /></font></p>
                <p><span class='blue sml'>&nbsp;&nbsp;Trying to reconnect to database . . .<br />&nbsp;&nbsp;Cannot connect to database.<br /></p>";
        } else {
            $success1 = @mysql_select_db ($database1, $db_con1);
            if (!$success1) {
                echo "<p><span class='blue sml'><br />&nbsp;&nbsp;Cannot choose database 1.<br /></p>";
            } else {
                return ($db_con1);
            }

        }
    }

    // Database2 connection
    function db2_con() {
        global $mysql_host2, $mysql_user2, $mysql_password2, $database2;

        $db_con2 = @mysql_pconnect ($mysql_host2, $mysql_user2, $mysql_password2);
        if (!$db_con2) {
            echo "<p><span class='red'>&nbsp;Mysql Server for database '$database2' not available!&nbsp;<br /></font></p>
                <p><span class='blue sml'>&nbsp;&nbsp;Trying to reconnect to database . . .<br />&nbsp;&nbsp;Cannot connect to database.<br /></p>";
        } else {
            $success2 = @mysql_select_db ($database2, $db_con2);
            if (!$success2) {
                echo "<p><span class='blue sml'><br />&nbsp;&nbsp;Cannot choose database 2.<br /></p>";
            } else {
                return ($db_con2);
            }

        }
    }

    // Database3 connection
    function db3_con() {
        global $mysql_host3, $mysql_user3, $mysql_password3, $database3;

        $db_con3 = @mysql_pconnect ($mysql_host3, $mysql_user3, $mysql_password3);
        if (!$db_con3) {
            echo "<p><span class='red'>&nbsp;Mysql Server for database '$database3' not available!&nbsp;<br /></font></p>
                <p><span class='blue sml'>&nbsp;&nbsp;Trying to reconnect to database . . .<br />&nbsp;&nbsp;Cannot connect to database.<br /></p>";
        } else {
            $success3 = @mysql_select_db ($database3, $db_con3);
            if (!$success3) {
                echo "<p><span class='blue sml'><br />&nbsp;&nbsp;Cannot choose database 3.<br /></p>";
            } else {
                return ($db_con3);
            }

        }
    }

    // Database4 connection
    function db4_con() {
        global $mysql_host4, $mysql_user4, $mysql_password4, $database4;

        $db_con4 = @mysql_pconnect ($mysql_host4, $mysql_user4, $mysql_password4);
        if (!$db_con4) {
            echo "<p><span class='red'>&nbsp;Mysql Server for database '$database4' not available!&nbsp;<br /></font></p>
                <p><span class='blue sml'>&nbsp;&nbsp;Trying to reconnect to database . . .<br />&nbsp;&nbsp;Cannot connect to database.<br /></p>";
        } else {
            $success4 = @mysql_select_db ($database4, $db_con4);
            if (!$success4) {
                echo "<p><span class='blue sml'><br />&nbsp;&nbsp;Cannot choose database 4.<br /></p>";
            } else {
                return ($db_con4);
            }

        }
    }

    // Database5 connection
    function db5_con() {
        global $mysql_host5, $mysql_user5, $mysql_password5, $database5;

        $db_con5 = @mysql_pconnect ($mysql_host5, $mysql_user5, $mysql_password5);
        if (!$db_con5) {
            echo "<p><span class='red'>&nbsp;Mysql Server for database '$database5' not available!&nbsp;<br /></font></p>
                <p><span class='blue sml'>&nbsp;&nbsp;Trying to reconnect to database . . .<br />&nbsp;&nbsp;Cannot connect to database.<br /></p>";
        } else {
            $success5 = @mysql_select_db ($database5, $db_con5);
            if (!$success5) {
                echo "<p><span class='blue sml'><br />&nbsp;&nbsp;Cannot choose database 5.<br /></p>";
            } else {
                return ($db_con5);
            }
        }
    }

?>
Return current item: Sphider Plus