sma-website /search/inc/auto_spider.inc.php

Language PHP Lines 117
MD5 Hash 7c5cb4d2108eeafbfb13e497c1c62bce Estimated Cost $1,980 (why?)
Repository https://bitbucket.org/molusc/sma-website.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php

/******************************************************************************
 * iSearch2 - website search engine                                           *
 *                                                                            *
 * Visit the iSearch homepage at http://www.iSearchTheNet.com/isearch         *
 *                                                                            *
 * Copyright (C) 2002-2007 Z-Host. All rights reserved.                       *
 *                                                                            *
 ******************************************************************************/

// PHPLOCKITOPT NOENCODE

if ( !defined('IN_ISEARCH') )
{
    die('Hacking attempt');
}

/* Set the following variable to True to debug the automatic spidering */
$isearch_verbose = False;

if ($isearch_verbose)
{
    echo "<p>iSearch autospider running</p>\n";
}

$isearch_path = dirname(__FILE__).'/..';

/* Include configuration options */
require_once "$isearch_path/inc/config.inc.php";

if ($isearch_db = mysql_connect($isearch_sql_server, $isearch_sql_username, $isearch_sql_password))
{
    if (mysql_select_db($isearch_sql_database, $isearch_db))
    {
        if ($result = mysql_query ("SELECT last_update FROM $isearch_table_info", $isearch_db))
        {
            if ($item = mysql_fetch_object($result))
            {
                if ($item->last_update == 0)
                {
                    require_once "$isearch_path/inc/core.inc.php";
                    require_once "$isearch_path/inc/spider.inc.php";

                    /* Open the search component */
                    if (isearch_open())
                    {
                        if ($isearch_verbose)
                        {
                            echo "<p>iSearch - Indexing the next file</p>\n";
                        }

                        /* Index a single file */
                        isearch_indexAFile($isearch_verbose);

                        /* Close the search component */
                        isearch_close();
                    }
                    else if ($isearch_verbose)
                    {
                        echo "<p>iSearch - Unable to open iSearch component</p>\n";
                    }
                }
                else if ($item->last_update + ($isearch_spider_hours * 3600) <= time())
                {
                    require_once "$isearch_path/inc/core.inc.php";
                    require_once "$isearch_path/inc/spider.inc.php";

                    /* Open the search component */
                    if (isearch_open())
                    {
                        if ($isearch_verbose)
                        {
                            echo "<p>iSearch - Resetting spider engine</p>\n";
                        }

                        /* Reset the spider engine to start spidering */
                        isearch_reset();

                        /* Close the search component */
                        isearch_close();
                    }
                    else if ($isearch_verbose)
                    {
                        echo "<p>iSearch - Unable to open iSearch component</p>\n";
                    }
                }
            }
            else if ($isearch_verbose)
            {
                echo "<p>iSearch - unable to read configuration information</p>\n";
            }
        }
        else if ($isearch_verbose)
        {
            echo "<p>iSearch - unable to query configuration table</p>\n";
        }
    }
    else
    {
        if ($isearch_verbose)
        {
            echo "<p>iSearch - unable to select database</p>\n";
        }
        mysql_close($isearch_db);
    }
}
else if ($isearch_verbose)
{
    echo "<p>iSearch - unable to connect to database</p>\n";
}

if ($isearch_verbose)
{
    echo "<p>iSearch autospider finished</p>\n";
}
Back to Top