Location: PHPKode > scripts > No404s > index.php
<?php

require 'conf.inc.php';


if (!class_exists('checklinksphp'))
{
    class checklinksphp
    {
        var $db; /* protected */
        var $httpvars = array(); /* private */
        var $getlink; /* private */
        var $days; /* private */
        var $siteself; /* private */
        var $action; /* private */
        var $getserver = array(); /* private */
        var $getpost = array(); /* private */
        var $howfast; /* private */
        var $howlook; /* private */
        var $gettitle; /* private */
        var $filefilter = array('html', 'htm', 'phtml', 'php', 'xhtml', 'php3', 'php4', 'css', 'js', 'rdf', 'doc', 'zip', 'rar', 'tar', 'gz', 'gzip', 'bz2', 'txt'); /* private */
        var $filter     = array('jpeg', 'jpe', 'jpg', 'gif', 'png', 'JPE', 'JPEG','JPG','GIF','PNG', 'css'); /* private */
        var $lang;
        var $final = array(); /* private */
        var $notsite = array(); /* private */

        function __construct($everything)
        {
            $this->db       = $this->dbh();

            foreach ($everything AS $key => $value)
            {
                $this->$key = $everything[$key];
            }
        }

        function __set($name,$value)
        {
            $this->$name = $value;
        }

        function __get($name)
        {
            if (isset($this->name))
            {
                return $this->name;
            }
        }

        function dolinkchecker()
        {
            $action = $this->allinput('action');

            $this->db->query("DELETE FROM `". PREFIX ."` WHERE `date` < NOW() - INTERVAL ". $this->days ." DAY");

            include 'header.inc.php';

            switch ($action)
            {
                case 'results':
                    echo $this->results();

                    break;
                case 'no404':
                    echo $this->linkchecker();

                    break;
                default:
                    echo $this->def();
                    break;
            }

            include 'footer.inc.php';
        }

        function addthoseslashes($text) /* protected */
        {
            if (get_magic_quotes_gpc())
            {
                $text = stripslashes($text);
            }

            if (!is_numeric($text))
            {
               $text = "'" . $this->db->escape($text) . "'";
            }

            return $text;
        }

        function stripthoseslashes(&$text) /* private */
        {
            if (get_magic_quotes_gpc())
            {
                $text = stripslashes($text);
            }

            return $text;
        }

        function dbh()
        {
            include 'conf.inc.php';

            if (!defined('SQL'))
            {
                define('SQL', '');

                include_once "ez_sql_mysql.php";
            }

            $dbe    = new ezSQL_mysql($user,$dbpassword,$dbname,$host);

            return $dbe;
        }

        //code from webmaster at m-bread dot com

        function get_urls($string, $strict=true) /* private */
        {
            $types = array("href", "src", "url");

            while(list(,$type) = each($types))
            {
                $innerT = $strict?'[a-z0-9:?=&@/._-]+?':'.+?';
                preg_match_all ("|$type\=([\"'`])(".$innerT.")\\1|i", $string, $matches);
                $ret[$type] = $matches[2];
            }

            return $ret;
        }
        //

        function resolve_href($href, $base) /* private */
        {
            // href="" ==> current url.
            if (!$href) {
                return $base;
            }

            // href="http://..." ==> href isn't relative
            $pos = strpos($href, 'http://');

            $rel_parsed = parse_url($href);
            if (array_key_exists('scheme', $rel_parsed))
            {
                return $href;
            }


            // add an extra character so that, if it ends in a /, we don't lose the last piece.
            $base_parsed = parse_url($base .' ');
            // if it's just server.com and no path, then put a / there.
            if (!array_key_exists('path', $base_parsed))
            {
                $base_parsed = parse_url($base .'/ ');
            }

            // href="/ ==> throw away current path.
            if ($href{0} === "/")
            {
                $path = $href;
            } else {
                $path = dirname($base_parsed['path']) . '/'. $href;
            }

            // bla/./bloo ==> bla/bloo
            $path = preg_replace('~/\./~', '/', $path);

            // resolve /../
            // loop through all the parts, popping whenever there's a .., pushing otherwise.
            $parts = array();
            foreach (explode('/', preg_replace('~/+~', '/', $path)) as $part)
            {
                if ($part === '..') {
                    array_pop($parts);
                } elseif ($part) {
                    $ext            = substr(strrchr($part, "."), 1);

                    if (in_array($ext, $this->filefilter))
                    {
                        $parts[] = $part;
                    } else {
                        $parts[] = $part .'/';
                    }
                }
            }

            $bitofurl   = '/' . implode('/', $parts);
            $bitofurl   = str_replace('//', '/', $bitofurl);

            return ((array_key_exists('scheme', $base_parsed)) ? $base_parsed['scheme'] . '://' . $base_parsed['host'] : '') . $bitofurl;
        }

        function gethost($serverhost, $type) /* private */
        {
            $subs           = '';
            $domainname     = '';
            $tld            = '';
            $tld_isReady    = 0;

            $gTlds = explode(',', str_replace(' ', '', "aero, biz, com, coop, info,
jobs, museum, name, net, org, pro, travel, gov, edu, mil, int"));

            $cTlds = explode(',', str_replace(' ', '', "ac, ad, ae, af, ag, ai, al,
am, an, ao, aq, ar, as, at, au, aw, az, ax, ba, bb, bd, be, bf, bg, bh,
bi, bj, bm, bn, bo, br, bs, bt, bv, bw, by, bz, ca, cc, cd, cf, cg, ch,
ci, ck, cl, cm, cn, co, cr, cs, cu, cv, cx, cy, cz, de, dj, dk, dm, do,
dz, ec, ee, eg, eh, er, es, et, eu, fi, fj, fk, fm, fo, fr, ga, gb, gd,
ge, gf, gg, gh, gi, gl, gm, gn, gp, gq, gr, gs, gt, gu, gw, gy, hk, hm,
hn, hr, ht, hu, id, ie, il, im, in, io, iq, ir, is, it, je, jm, jo, jp,
ke, kg, kh, ki, km, kn, kp, kr, kw, ky, kz, la, lb, lc, li, lk, lr, ls,
lt, lu, lv, ly, ma, mc, md, me, mg, mh, mk, ml, mm, mn, mo, mp, mq, mr, ms,
mt, mu, mv, mw, mx, my, mz, na, nc, ne, nf, ng, ni, nl, no, np, nr, nu,
nz, om, pa, pe, pf, pg, ph, pk, pl, pm, pn, pr, ps, pt, pw, py, qa, re,
ro, ru, rw, sa, sb, sc, sd, se, sg, sh, si, sj, sk, sl, sm, sn, so, sr,
st, sv, sy, sz, tc, td, tf, tg, th, tj, tk, tl, tm, tn, to, tp, tr, tt,
tv, tw, tz, ua, ug, uk, um, us, uy, uz, va,
vc, ve, vg, vi, vn, vu, wf, ws, ye, yt, yu, za, zm, zw"));

            $tldarray = array_merge($gTlds,$cTlds);

            $domainarray = explode('.', $serverhost);

            $top = count($domainarray);

            for ($i = 0; $i < $top; $i++)
            {
                $_domainPart = array_pop($domainarray);

                if ($tld_isReady == 0)
                {
                    if (in_array($_domainPart, $tldarray))
                    {
                        $tld = ".". $_domainPart . $tld;
                    } else {
                        $domainname = $_domainPart;
                        $tld_isReady = 1;
                    }
                } else {
                    $subs = ".". $_domainPart . $subs;
                }
            }

            if ($type == 'domain')
            {
                return $domainname . $tld;
            } elseif ($type == 'sub') {
                return substr($subs ,1);
            }
        }

        function mergem($url, $indent, $getlinkarray) /* private */
        {
            if ($indent > $this->howmanydeep)
            {
                $this->getlink  = $getlinkarray;

                return;
            } else {
                $getlink = array();

                sleep(2);

                $ext            = substr(strrchr($url, "."), 1);

                if (!in_array($ext, $this->filter))
                {
                    $gotlinks   = $this->gotlinks($url);

                    $link       = $gotlinks['href'];

                    $numlinks   = count($link);
                } else {
                    $numlinks   = 0;
                }

                $final[$url]    = 'yes';

                $final          = array();

                if ($numlinks > 0)
                {
                    $serverhost = $this->getserver('SERVER_NAME');

                    $serverhost = $this->gethost($serverhost, 'domain');

                    foreach ($link AS $key => $value)
                    {
                        if ($this->siteself == 1)
                        {
                            if (!isset($this->final[$value]))
                            {
                                if (!isset($final[$value]))
                                {
                                    $value          = $this->resolve_href($value, $this->urlpost);
                                    $linkhost       = parse_url($value);
                                    $urlhostparse   = parse_url($this->urlpost);

                                    if (isset($linkhost['host']) && isset($urlhostparse['host']))
                                    {
                                        $sitehost       = $linkhost['host'];

                                        $finalhost  = $this->gethost($sitehost, 'domain');
                                        $urlhost    = $this->gethost($urlhostparse['host'], 'domain');
						                $ext		= substr(strrchr($value, "."), 1);

                                        if ($urlhost == $finalhost && !in_array($ext, $this->filter))
                                        {
                                            $sql        = "INSERT INTO `". PREFIX ."` (`Link`, `originatingurl`) VALUES(". $this->addthoseslashes($value) .", ". $this->addthoseslashes($url) .")";

                                            $insertlink = $this->db->query($sql);
                                            $this->final[$value]= 'no';
                                            $final[$value]      = 'no';
                                        } else {
                                            $this->final[$value]= 'yes';
                                        }
                                    }
                                }
                            }
                        } else {
                            if (!isset($this->notsite[$value]))
                            {
                                if (!isset($notsite[$value]))
                                {
                                    $value          = $this->resolve_href($value, $this->urlpost);
                                    $linkhost       = parse_url($value);

                                    if (isset($linkhost['host']))
                                    {
                                        $sitehost       = $linkhost['host'];

                                        $finalhost  = $this->gethost($sitehost, 'domain');
						                $ext		= substr(strrchr($value, "."), 1);

                                        if ($serverhost != $finalhost && !in_array($ext, $this->filter))
                                        {
                                            $sql        = "INSERT INTO `". PREFIX ."` (`Link`, `originatingurl`) VALUES(". $this->addthoseslashes($value) .", ". $this->addthoseslashes($url) .")";

                                            $insertlink = $this->db->query($sql);
                                            $this->notsite[$value]= 'no';
                                            $notsite[$value]        = 'no';
                                        } else {
                                            $this->final[$value]= 'no';
                                            $final[$value]      = 'no';
                                        }
                                    }
                                }
                            }
                        }
                    }

                    foreach ($final AS $tinylink => $tinyvalue)
                    {
                        if (!empty($tinylink) && $tinyvalue == 'no')
                        {
                            $tinylink   = $this->resolve_href($tinylink, $this->urlpost);

                            $web 	= substr($tinylink,0,7);
                            $webs 	= substr($tinylink,0,8);

                            if ($web == 'http://' || $webs == 'https://')
                            {
                                if($tinylink == 'http://' || $tinylink == 'https://')
                                {
                                    $tinylink = '';
                                }
                            } elseif ($web != 'http://' && $webs != 'https://') {
                                if ($tinylink != 'http://' && $tinylink != 'https://')
                                {
                                    $tinylink = 'http://'. $tinylink;
                                } else {
                                    $tinylink = '';
                                }
                            }

                            if ($this->siteself == 1)
                            {
                                $linkhost       = '';
                                $linkhost       = parse_url($tinylink);
                                $sitehost       = $linkhost['host'];

                                $sitehost   = $this->gethost($sitehost, 'domain');

                                if ($serverhost == $sitehost)
                                {
                                    if ($indent > $this->howmanydeep)
                                    {
                                        $this->getlink  = $this->final;

                                        return;
                                    }

                                    if ($this->onlysub == 1)
                                    {
                                        if (eregi($this->urlpost, $tinylink))
                                        {
                                            $this->mergem($tinylink, $indent+1, $this->final);
                                        }
                                    } else {
                                        $this->mergem($tinylink, $indent+1, $this->final);
                                    }
                                }
                            } else {
                                if ($indent > $this->howmanydeep)
                                {
                                    $this->getlink  = $this->notsite;

                                    return;
                                }

                                if ($this->onlysub == 1)
                                {
                                    if (eregi($this->urlpost, $tinylink))
                                    {
                                        $this->mergem($tinylink, $indent+1, $this->notsite);
                                    }
                                } else {
                                    $this->mergem($tinylink, $indent+1, $this->notsite);
                                }
                            }
                        }
                    }
                }
            }
        }

        function gotlinks($url) /* private */
        {
            $body       = $this->getpage($url);

            $getlinks   = $this->get_urls($body, TRUE);

            return $getlinks;
        }

        function array_merge_keys($arr1, $arr2) /* private */
        {
           foreach($arr2 as $k=>$v)
           {
                if (!array_key_exists($k, $arr1))
                {
                    $arr1[$k]=$v;
                } else {
                    if (is_array($v))
                    {
                        $arr1[$k]=$this->array_merge_keys($arr1[$k], $arr2[$k]);
                    }
                }
            }

            return $arr1;
        }

        function array_key_filter_multi($array, $callback, $filtered_output = "") /* private */
        {
           $ret = array();

           foreach($array as $key=>$value)
           {
                if(is_array($value))
                {
                    $ret[$key] = $this->array_key_filter_multi($value, $callback, $filtered_output);
                } elseif(is_object($value)) {
                    $ret[$key] = $this->array_key_filter_multi(get_object_vars($value), $callback, $filtered_output);
                } else {
                $ret[$key] = $this->$callback($value);
                }
           }

           return $ret;
        }

        function array_shift2(&$arr) /* private */
        {
            $start  = true;
            unset($new_arr);

            foreach ($arr as $key => $value)
            {
                if ($start)
                {
                    $to_ret = $value;
                    $start  = false;
                } else {
                    $new_arr[$key]  = $value;
                }
            }

            $arr    = $new_arr;

            return $to_ret;
        }

        function intersect_key_array() /* private */
        {
            $arrs       = func_get_args();
            $result     = $this->array_shift2($arrs);
            $newresult  = array();

            foreach ($arrs as $array)
            {
                $x = 0;

                foreach ($result as $key => $v)
                {
                    if (array_key_exists($key, $array))
                    {
                        $newresult[$x] = $key;
                        $x++;
                    }
                }
            }

            return $newresult;
        }

        function getserver($value) /* protected */
        {
            if (isset($this->getserver[$value]))
            {
                return $this->getserver[$value];
            }
        }

        function retserver()
        {
            $server = $_SERVER;

            if (is_array($server))
            {
                $server = $this->array_key_filter_multi($server, 'clean', '');
            }

            $this->getserver    = $server;

            return $server;
        }

        function retget()
        {
            $httpvars   = $_GET;
            $httpvars   = $this->array_key_filter_multi($httpvars, 'clean', '');

            $this->httpvars = $httpvars;

            return $httpvars;
        }

        function retpost($clean = 1)
        {
            $getpost    = $_POST;

            if ($clean == 1)
            {
                $getpost    = $this->array_key_filter_multi($getpost, 'clean', '');
            }

            return $getpost;
        }

        function allinput($value) /* protected */
        {
            if (isset($this->httpvars[$value]))
            {
                return $this->httpvars[$value];
            }
        }

        function getpost($value) /* private */
        {
            if (isset($this->getpost[$value]))
            {
                return $this->getpost[$value];
            }
        }

        function clean($cleanget) /* private */
        {
            if (!is_array($cleanget))
            {
                if (is_numeric($cleanget))
                {
                    return $cleanget;
                } else {
                    $cleanget   = trim($cleanget);
                    $cleanget   = $this->stripthoseslashes($cleanget);

                    $cleanget   = $this->toHtml($cleanget);

                    $cleanget   = preg_replace( '/&amp;#x([A-Fa-f0-9]+);/m', "&#x\\1;" , $cleanget );
                    $cleanget   = preg_replace( '/&amp;#x([A-Fa-f0-9]+);/m', "&#x\\1;" , $cleanget );
                    $cleanget   = preg_replace( '/&amp;#(\d+);/m', "&#\\1;" , $cleanget );
                    $cleanget   = preg_replace( '/&amp;(\w+);/m', "&\\1;" , $cleanget );

                    /**
                    *  ‘  8216  curly left single quote
                    *  ’  8217  apostrophe, curly right single quote
                    *  “  8220  curly left double quote
                    *  ”  8221  curly right double quote
                    *  —  8212  em dash
                    *  –  8211  en dash
                    *  …  8230  ellipsis
                    */
                    $search = array(
                                    '"',
                                    "'",
                                    '(',
                                    ')',
                                    chr(212),
                                    chr(213),
                                    chr(210),
                                    chr(211),
                                    chr(209),
                                    chr(208),
                                    chr(201),
                                    chr(145),
                                    chr(146),
                                    chr(147),
                                    chr(148),
                                    chr(151),
                                    chr(150),
                                    chr(133)
                                    );

                    $replace = array(
                                    '&quot;',
                                    '&#39;',
                                    '&#40;',
                                    '&#41;',
                                    '&#8216;',
                                    '&#8217;',
                                    '&#8220;',
                                    '&#8221;',
                                    '&#8211;',
                                    '&#8212;',
                                    '&#8230;',
                                    '&#8216;',
                                    '&#8217;',
                                    '&#8220;',
                                    '&#8221;',
                                    '&#8211;',
                                    '&#8212;',
                                    '&#8230;'
                                    );

                    $cleanget   = str_replace($search, $replace, $cleanget);

                    return $cleanget;
                }
            }

            return '';
        }

        function toHtml($str) /* private */
        {
            if (!defined('UNICODE'))
            {
                define('UNICODE', '');
                require_once('I18N_UnicodeString.php');
            }

			$str		= $this->htmlentities2unicodeentities($str);
            $u 			= new I18N_UnicodeString($str, 'HTML');


            $numbers    = $u->utf8ToUnicode($str);

			if (!is_array($numbers))
			{
				if (function_exists('mb_detect_encoding') && function_exists('iconv'))
				{
					$str		= $this->convert_to_utf8($str);
				} else {
					$str 		= $u->toUtf8String();
				}

				$numbers    = $u->utf8ToUnicode($str);
			}

            $var        = '';

			if (is_array($numbers))
			{
	            foreach ($numbers as $nr)
	            {
	                if ($nr > 127) {
	                    $var .= '&#' . $nr . ';';
	                } else {
	                    $var .= chr($nr);
	                }
	            }
			}

            return $var;
        }

		function convert_to_utf8($str)
		{
			if( mb_detect_encoding($str,"UTF-8, GBK, iso-8859-1, ISO-8859-1, JIS, eucjp-win, sjis-win,EUC-KR,x-sjis,SJIS,Shift_JIS,EUC-JP,BIG5,EUC-CN,EUC-TW")!="UTF-8" )
			{
				$encoding	= mb_detect_encoding($str,"ASCII,JIS,UTF-8,EUC-KR,EUC-TW,EUC-CN,EUC-JP,SJIS,BIG-5,CP950,ISO-8859-1");

				if (empty($encoding)) $encoding	= 'ISO-8859-1';

				return  mb_convert_encoding($str,"utf-8", $encoding);
			} else {
				return $str;
			}

			return $str;
		} 
		
		//rbotzer at yahoo dot com
		
		function htmlentities2unicodeentities($input) 
		{
			$htmlEntities = array_values (get_html_translation_table (HTML_ENTITIES, ENT_QUOTES));
			$entitiesDecoded = array_keys   (get_html_translation_table (HTML_ENTITIES, ENT_QUOTES));
			$num = count ($entitiesDecoded);
			for ($u = 0; $u < $num; $u++)
			{
				$utf8Entities[$u] = '&#'.ord($entitiesDecoded[$u]).';';
			}
			return str_replace($htmlEntities, $utf8Entities, $input);
		}
		//

        function FromHtml($cleanget, $noutf = 0) /* private */
        {
            if ($noutf == 0)
            {
                if (!defined('UNICODE'))
                {
                    define('UNICODE', '');
                    require_once('I18N_UnicodeString.php');
                }

                $u = new I18N_UnicodeString($cleanget, 'HTML');
                $cleanget   = $u->toUtf8String();
            }

            $cleanget   = preg_replace('/&#(\d+);/me',"chr(\\1)",$cleanget); #decimal notation
            $cleanget   = preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)",$cleanget);  #hex notation

            if ($noutf == 0)
            {
                $cleanget   = preg_replace_callback('/&([A-Za-z]+);/', array(&$this, 'finaldecode'),$cleanget);
            } else {
                $cleanget   = preg_replace_callback('/&([A-Za-z]+);/', array(&$this, 'finalnoutfdecode'),$cleanget);
            }

            return $cleanget;
        }

        function finalnoutfdecode($var) /* private */
        {
            return html_entity_decode($var[0]);
        }

        function finaldecode($var) /* private */
        {
            return utf8_encode(html_entity_decode($var[0]));
        }

        function urldecodeunicode($a) /* private */
        {
            $utf    ='';

            if (isset($a[1]))
            {
                $utf = '&#x' . $a[1]. ';';
            }

            return $utf;
        }

        function def() /* private */
        {
            $body = '
                    <form action="'. basename($this->getserver('PHP_SELF')) .'" method="post">
                        <input type="submit" value="'. $this->lang->lang_bdeleteoldlinks .'" name="checked" class="submit" />
                    </form>';

            $deletechecked  = $this->getpost('checked');

            if (!empty($deletechecked))
            {
                $this->db->query("DELETE FROM `". PREFIX ."`");

                $body   .= '<p>'. $this->lang->lang_linksdeleted .'</p>';
            }

            $body   .= '
                    <form method="post" action="'. basename($this->getserver('PHP_SELF')) .'?action=no404" enctype="multipart/form-data">
                        <div class="centered">
                            <del class="container">
                                <div id="form1">
                                    <fieldset class="set">
                                        <legend>'. $this->lang->lang_legend .'</legend>
                                        <div style="height: 10px;"></div>
                                        <div class="form2">
                                            <label for="link">'. $this->lang->lang_posturl .'</label>
                                            <span><input type="text" class="inputfield" id="link" name="link" value="" /></span>
                                        </div>
                                        <div class="form2">
                                            <label for="link">'. $this->lang->lang_postmany .'</label>
                                            <span><input type="text" class="inputfield" id="howmany" name="howmany" value="" /></span>
                                        </div>
                                        <div class="form2">
                                            <label for="onlysub">'. $this->lang->lang_onlysub .'</label>
                                            <span><input type="checkbox" class="inputfield" id="onlysub" name="onlysub" value="1" /></span>
                                        </div>
                                        <div class="form2">
                                            <label>&nbsp;</label>
                                            <span>
                                                <input type="hidden" name="action" id="action" value="no404" />
                                                <input type="submit" name="submit" id="submit" class="submit" value="'. $this->lang->lang_bsubmit .'" />
                                            </span>
                                        </div>
                                    </fieldset>
                                </div>
                            </del>
                        </div>
                    </form>';
            echo $body;
        }

        function results() /* private */
        {
            $this->db->hide_errors();

            $text['N/A']   = $this->lang->lang_clcodeNA;
            $text['OK']    = $this->lang->lang_clcodeOK;
            $text['FEJL']  = $this->lang->lang_clcodeFEJL;
            $text['Dead']  = $this->lang->lang_clcodeDead;
            $text['100']   = $this->lang->lang_clcode100;
            $text['101']   = $this->lang->lang_clcode101;
            $text['200']   = $this->lang->lang_clcode200;
            $text['201']   = $this->lang->lang_clcode201;
            $text['202']   = $this->lang->lang_clcode202;
            $text['203']   = $this->lang->lang_clcode203;
            $text['204']   = $this->lang->lang_clcode204;
            $text['205']   = $this->lang->lang_clcode205;
            $text['206']   = $this->lang->lang_clcode206;
            $text['300']   = $this->lang->lang_clcode300;
            $text['301']   = $this->lang->lang_clcode301;
            $text['302']   = $this->lang->lang_clcode302;
            $text['303']   = $this->lang->lang_clcode303;
            $text['304']   = $this->lang->lang_clcode304;
            $text['305']   = $this->lang->lang_clcode305;
            $text['307']   = $this->lang->lang_clcode307;
            $text['400']   = $this->lang->lang_clcode400;
            $text['401']   = $this->lang->lang_clcode401;
            $text['402']   = $this->lang->lang_clcode402;
            $text['403']   = $this->lang->lang_clcode403;
            $text['404']   = $this->lang->lang_clcode404;
            $text['405']   = $this->lang->lang_clcode405;
            $text['406']   = $this->lang->lang_clcode406;
            $text['407']   = $this->lang->lang_clcode407;
            $text['408']   = $this->lang->lang_clcode408;
            $text['409']   = $this->lang->lang_clcode409;
            $text['410']   = $this->lang->lang_clcode410;
            $text['411']   = $this->lang->lang_clcode411;
            $text['412']   = $this->lang->lang_clcode412;
            $text['413']   = $this->lang->lang_clcode413;
            $text['414']   = $this->lang->lang_clcode414;
            $text['415']   = $this->lang->lang_clcode415;
            $text['416']   = $this->lang->lang_clcode416;
            $text['417']   = $this->lang->lang_clcode417;
            $text['500']   = $this->lang->lang_clcode500;
            $text['501']   = $this->lang->lang_clcode501;
            $text['502']   = $this->lang->lang_clcode502;
            $text['503']   = $this->lang->lang_clcode503;
            $text['504']   = $this->lang->lang_clcode504;
            $text['505']   = $this->lang->lang_clcode505;

            $getnum     = (int)$this->allinput('number');
            $howresults = $this->allinput('results');

            if (empty($howresults))
            {
                $howresults = $this->getpost('results');
            }

            if (empty($howresults))
            {
                echo $this->handle_exceptions($this->lang->lang_noresultsset);
				exit;
            }

            echo '
                <table border="0" width="100%" cellpadding="4" cellspacing="1" class="center">
                    <tr class="trheader">
                        <td colspan="6">&nbsp;</td>
                    </tr>
                    <tr class="trmiddle">
                        <th>'. $this->lang->lang_clname .'</th>
                        <th>'. $this->lang->lang_clurl .'</th>
                        <th>'. $this->lang->lang_clcode .'</th>
                        <th>'. $this->lang->lang_cldescription .'</th>
                    </tr>';

            $total      = $this->db->get_var("SELECT COUNT(`Link`) FROM `". PREFIX ."`");
            $getlinks   = $this->db->get_results("SELECT `Link`,`numerrors`, `originatingurl` FROM `". PREFIX ."` GROUP BY `Link` ORDER BY `". $howresults ."` LIMIT ". $getnum .", ". NUMBER);
            if ($this->db->num_rows > 0)
            {
                $serverhost = $this->getserver('SERVER_NAME');

                $serverhost = $this->gethost($serverhost, 'domain');

                $final      = '';

                $codesused  = array();

                $oddeven    = '';

                foreach ($getlinks AS $links)
                {
                    $link           = $links->Link;

                    $numerrors      = (int)$links->numerrors;
                    $originatingurl = $links->originatingurl;
                    if (!empty($link))
                    {
                        $web 	= substr($link,0,7);
						$webs 	= substr($link,0,8);

                        if ($web == 'http://' || $webs == 'https://')
                        {
                            if($link == 'http://' || $link == 'https://')
                            {
                                $link = '';
                            }
                        } elseif ($web != 'http://' && $webs != 'https://') {
                            if ($link != 'http://' && $link != 'https://')
                            {
                                $link = 'http://'. $link;
                            } else {
                                $link = '';
                            }
                        }

                        if (!empty($link))
                        {
                            if ($this->siteself == 1)
                            {
                                $linkhost       = '';
                                $linkhost       = parse_url($link);
                                $sitehost       = $linkhost['host'];

                                $sitehost       = $this->gethost($sitehost, 'domain');

                                if ($serverhost == $sitehost)
                                {
                                    $textcode   = '';
                                    $errorm     = '';
                                    $titlex     = '';
                                    $code       = '';
                                    $errorc     = 0;

                                    $check  = $this->check_url($link, $this->howlook, $this->howfast, $this->gettitle);

                                    if (isset($check['title']))
                                    {
                                        $titlex = $check['title'];
                                    }

                                    if (isset($check['code']))
                                    {
                                        $code   = $check['code'];
                                    }

                                    if (!empty($code))
                                    {
                                        $textcode = $text[$code];

                                        $codesused[$code]       = $textcode;
                                        $final[$code]['name'] = $textcode;

                                        if(!isset($final[$code]['number']))
                                        {
                                            $final[$code]['number'] = 0;
                                        }

                                        $final[$code]['number'] = $final[$code]['number'] + 1;
                                    }

                                    $numerrors  = 0;

                                    if (isset($check['errorm']))
                                    {
                                        $errorm = $check['errorm'];
                                    } elseif ($code != '200') {
                                        $errorc = 1;

                                        $final[$code]['links'][] = $link;

                                        $numerrors  = $numerrors + 1;
                                    }

                                    $sql = "INSERT INTO `". PREFIX ."` (`numerrors`, `Link`, `LinkTitle`, `LinkTextCode`, `LinkCode`, `LinkError`) VALUES(".
                                        $numerrors .", ".
                                        $this->addthoseslashes($link) .", ".
                                        $this->addthoseslashes($titlex) .", ".
                                        $this->addthoseslashes($textcode) .", ".
                                        $this->addthoseslashes($code) .", ".
                                        $this->addthoseslashes($errorm) .")";

                                    $insertlink = $this->db->query($sql);

                                    if (!$insertlink)
                                    {
                                        $sql = "UPDATE `". PREFIX ."` SET ".
                                            "`numerrors`=". $numerrors .", ".
                                            "`LinkTitle`=". $this->addthoseslashes($titlex) .", ".
                                            "`LinkTextCode`=". $this->addthoseslashes($textcode) .", ".
                                            "`LinkCode`=". $this->addthoseslashes($code) .", ".
                                            "`LinkError`=". $this->addthoseslashes($errorm) .
                                            " WHERE `Link`=". $this->addthoseslashes($link);

                                        $updatelink = $this->db->query($sql);
                                    }

                                    echo '<tr class="';

                                    if (!empty($errorm) || $errorc == 1)
                                    {
                                        echo 'trcontenterror';
                                    } else {
                                        echo 'trcontent'. $oddeven;
                                    }

                                    echo '">
                                        <td></td>';

                                        $small_link = $link;

                                        $length     = strlen($small_link);

                                        $limit      = 40;

                                        if ($length > $limit)
                                        {
                                            $small_link = substr($small_link,0,$limit) .'...';
                                        }

                                    echo '
                                        <td><a href="'. $link .'" title="'. $link .'">'. $small_link .'</a></td>
                                        <td>'. $code .'</td>
                                        <td>'. $textcode .'</td>
                                    </tr>';

                                    if (isset($titlex))
                                    {
                                        echo '<tr class="';

                                        if (!empty($errorm) || $errorc == 1)
                                        {
                                            echo 'trcontenterror';
                                        } else {
                                            echo 'trcontent'. $oddeven;
                                        }

                                        echo '"><td><strong>'. $this->lang->lang_cltitle .'</strong></td><td colspan="5"><strong>'. $this->the_wordwrap($titlex) .'</strong></td>
                                        </tr>';
                                    }

                                    if (isset($originatingurl))
                                    {
                                        echo '<tr class="';

                                        if (!empty($errorm) || $errorc == 1)
                                        {
                                            echo 'trcontenterror';
                                        } else {
                                            echo 'trcontent'. $oddeven;
                                        }

                                        echo '"><td><strong>'. $this->lang->lang_originatingurl .'</strong></td><td colspan="5"><a href="'. $originatingurl .'">'. wordwrap($originatingurl, 40, "<br />\n", 1) .'</a></strong></td>
                                        </tr>';
                                    }

                                    if ($numerrors > 0)
                                    {
                                        echo '<tr class="';

                                        if (!empty($errorm) || $errorc == 1)
                                        {
                                            echo 'trcontenterror';
                                        } else {
                                            echo 'trcontent'. $oddeven;
                                        }

                                        echo '"><td><strong>'. $this->lang->lang_numerrors .'</strong></td><td colspan="5">'. $numerrors .'</strong></td>
                                        </tr>';
                                    }

                                    flush();

                                    if (!empty($errorm))
                                    {
                                        echo '<tr class="trcontenterror">
                                        <td><strong>'. $this->lang->lang_clerrortext .'</strong></td><td colspan="5">'. $errorm .'</td>
                                    </tr>';
                                    }
                                } else {
                                    $righthost  = 0;
                                }
                            } else {
                                $textcode   = '';
                                $errorm     = '';
                                $titlex     = '';
                                $code       = '';
                                $errorc     = 0;

                                $check  = $this->check_url($link, $this->howlook, $this->howfast, $this->gettitle);
                                if (isset($check['title']))
                                {
                                    $titlex = $check['title'];
                                }

                                if (isset($check['code']))
                                {
                                    $code   = $check['code'];
                                }

                                if (!empty($code))
                                {
                                    $textcode = $text[$code];

                                    $final[$code]['name']   = $textcode;
                                    $codesused[$code]       = $textcode;
                                    if(!isset($final[$code]['number']))
                                    {
                                        $final[$code]['number'] = 0;
                                    }

                                    $final[$code]['number'] = $final[$code]['number'] + 1;
                                }

                                $numerrors  = 0;

                                if (isset($check['errorm']))
                                {
                                    $errorm = $check['errorm'];
                                } elseif ($code != '200') {
                                    $errorc = 1;

                                    $final[$code]['links'][] = $link;

                                    $numerrors  = $numerrors + 1;
                                }

                                $sql = "INSERT INTO `". PREFIX ."` (`numerrors`, `Link`, `LinkTitle`, `LinkTextCode`, `LinkCode`, `LinkError`) VALUES(".
                                    $numerrors .", ".
                                    $this->addthoseslashes($link) .", ".
                                    $this->addthoseslashes($titlex) .", ".
                                    $this->addthoseslashes($textcode) .", ".
                                    $this->addthoseslashes($code) .", ".
                                    $this->addthoseslashes($errorm) .")";

                                $insertlink = $this->db->query($sql);

                                if (!$insertlink)
                                {
                                    $sql = "UPDATE `". PREFIX ."` SET ".
                                        "`numerrors`=". $numerrors .", ".
                                        "`LinkTitle`=". $this->addthoseslashes($titlex) .", ".
                                        "`LinkTextCode`=". $this->addthoseslashes($textcode) .", ".
                                        "`LinkCode`=". $this->addthoseslashes($code) .", ".
                                        "`LinkError`=". $this->addthoseslashes($errorm) .
                                        " WHERE `Link`=". $this->addthoseslashes($link);

                                    $updatelink = $this->db->query($sql);
                                }

                                echo '<tr class="';

                                if (!empty($errorm) || $errorc == 1)
                                {
                                    echo 'trcontenterror';
                                } else {
                                    echo 'trcontent'. $oddeven;
                                }

                                echo '">
                                    <td></td>';

                                $small_link = $link;

                                $length     = strlen($small_link);
                                $limit      = 40;

                                if ($length > $limit)
                                {
                                    $small_link = substr($small_link,0,$limit) .'...';
                                }

                                echo '
                                    <td><a href="'. $link .'" title="'. $link .'">'. $small_link .'</a></td>
                                    <td>'. $code .'</td>
                                    <td>'. $textcode .'</td>
                                </tr>';

                                if (isset($titlex))
                                {
                                    echo '<tr class="';

                                    if (!empty($errorm) || $errorc == 1)
                                    {
                                        echo 'trcontenterror';
                                    } else {
                                        echo 'trcontent'. $oddeven;
                                    }

                                    echo '"><td><strong>'. $this->lang->lang_cltitle .'</strong></td><td colspan="5"><strong>'. $this->the_wordwrap($titlex) .'</strong></td>
                                    </tr>';
                                }

                                if (isset($originatingurl))
                                {
                                    echo '<tr class="';

                                    if (!empty($errorm) || $errorc == 1)
                                    {
                                        echo 'trcontenterror';
                                    } else {
                                        echo 'trcontent'. $oddeven;
                                    }

                                    echo '"><td><strong>'. $this->lang->lang_originatingurl .'</strong></td><td colspan="5"><a href="'. $originatingurl .'">'. wordwrap($originatingurl, 40, "<br />\n", 1) .'</a></strong></td>
                                    </tr>';
                                }

                                if ($numerrors > 0)
                                {
                                    echo '<tr class="';

                                    if (!empty($errorm) || $errorc == 1)
                                    {
                                        echo 'trcontenterror';
                                    } else {
                                        echo 'trcontent'. $oddeven;
                                    }

                                    echo '"><td><strong>'. $this->lang->lang_numerrors .'</strong></td><td colspan="5">'. $numerrors .'</strong></td>
                                    </tr>';
                                }

                                flush();

                                if (!empty($errorm))
                                {
                                    echo '<tr class="trcontenterror">
                                    <td><strong>'. $this->lang->lang_clerrortext .'</strong></td><td colspan="5">'. $errorm .'</td>
                                </tr>';
                                }
                            }
                        }

                        $oddeven    = (empty($oddeven) ? 'odd' : '');
                    }
                }
            }

            echo '
                    <tr class="trcontent">
                        <td colspan="4">
                        '. $this->navigation($total, $getnum, $howresults) .'
                        </td>
                    </tr>
                    <tr class="trheader">
                        <td colspan="4">';

            if (!empty($final))
            {
                echo '
                        <br /><br />';

                $result =  $this->intersect_key_array($final, $codesused);

                $numcodes   = count($result);

                for($b = 0; $b < $numcodes; $b++)
                {
                    $codename = $result[$b];

                    echo '
                        <h3>'. $codename .' - '. $final[$codename]['name'] .'  ('. $final[$codename]['number'] .')</h3>
                        <p>';

                    if (isset($final[$codename]['links']))
                    {
                        $numcodelinks   = count($final[$codename]['links']);

                        for($c = 0; $c < $numcodelinks; $c++)
                        {
                            echo '
                            <a href="'. $final[$codename]['links'][$c] .'">'. $final[$codename]['links'][$c] .'</a><br />';
                        }
                    }

                    echo '
                        </p>';
                }
            }

            echo '
                        </td>
                    </tr>
                </table>';
        }
		
		function handle_exceptions($e)
		{
			return "<p>Error: ". $e ."</p>\n";
		}

        function linkchecker() /* private */
        {
            $this->db->hide_errors();

            $this->urlpost  = $this->getpost('link');

            if (empty($this->urlpost))
            {
                $this->handle_exceptions($this->lang->lang_nourlset);
				exit;
            }

            $this->onlysub  = (int)$this->getpost('onlysub');

            $this->howmanydeep  = (int)$this->getpost('howmany');

            if ($this->howmanydeep == 0)
            {
                $this->howmanydeep  = 1;
            }

            $links      = $this->mergem($this->urlpost, 1, array(), '', '');

            echo '
                <label for="results"><strong><em>'. $this->lang->lang_results .'</em></strong></label>
                <form action="'. basename($this->getserver('PHP_SELF')) .'?action=results" method="post">
                    <select name="results" >
                        <option value="originatingurl" selected="selected">'. $this->lang->lang_resultsorig .'</option>
                        <option value="Link">'. $this->lang->lang_resultsalpha .'</option>
                    </select>
                    &nbsp;<input type="submit" value="'. $this->lang->lang_bsubmit .'" class="submit" />
                </form>';
        }

        function getpage($url) /* private */
        {
            $str = '';
            if (eregi('^http://', $url) || eregi('^https://', $url))
            {
                $urlArray = @parse_url($url);

                if (function_exists('curl_init'))
                {
                    $ch = curl_init();
                    curl_setopt($ch, CURLOPT_URL, $url);

                    /* set the user agent - might help, doesn't hurt */
                    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

                    /* try to follow redirects */
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

                    /* timeout after the specified number of seconds. assuming that this script runs on a server, 20 seconds should be plenty of time to verify a valid URL.  */
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 20);

                    /* don't download the page, just the header (much faster in this case) */

                    curl_setopt($ch, CURLOPT_HEADER, true);
                    curl_setopt($ch, CURLOPT_HTTPGET, true); //this is needed to fix the issue

                    curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');

                    /* handle HTTPS links */
                    if($urlArray['scheme']=='https')
                    {
                        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  1);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                    }

                    $str = curl_exec($ch);
                    curl_close($ch);
                } else {
                    if (!isset($urlArray['port']))
                        $urlArray['port'] =  '80';
                    if (!isset($urlArray['path']))
                        $urlArray['path'] =  '/';
                        $sock = @fsockopen($urlArray['host'], $urlArray['port'], $errnum, $errstr, 10);
                    if (!$sock)
                        $res['code'] =  'Dead';
                    else
                    {
                        $query = '';
                        if (isset($urlArray['query']))
                        {
                            $query = '?'. $urlArray['query'];
                        }

                        $dump =  "GET ". $urlArray['path'] . $query ." HTTP/1.1\r\n";
                        $dump .=  "Host: ". $urlArray['host'] ."\r\n";
                        $dump .=  "Connection: close\r\n\r\n";

                        fputs($sock, $dump);

                        $str = array();

                        while (!feof($sock))
                        {
                            $str .= fread($sock, 8192);
                        }

                        fclose($sock);

                        flush();
                    }
                }
            }

            return $str;
        }

        function navigation($total, $getnum, $results) /* private */
        {
            $nav = '';

            if ($total > 0)
            {
                if ($getnum != 0)
                {
                    $nav .= '<a href="'. basename($this->getserver('PHP_SELF')) .'?action=results&amp;results='. $results .'">1</a>'."\n";
                }

                $TPages = $total / NUMBER;

                $nump           = (int)$getnum;
                $nump           = round($nump/NUMBER);
                $nump           = NUMBER * $nump;
                $phpfanpages    = $nump / NUMBER;

                $phpfanpages = $phpfanpages + 1;

                if ($phpfanpages > 7)
                {
                    $nav .= '...';
                }

                $SPages = ceil($TPages);

                if ($TPages > 1)
                {
                    $minfive = $phpfanpages - 5;

                    for ($b=$minfive,$c=$minfive; $b < ($minfive + 5); $b++,$c++)
                    {
                        $Res1 = (NUMBER * $b) - NUMBER;

                        if ($c != 1)
                        {
                            if ($b > 1)
                            {
                                $nav .= '<a href="'. basename($this->getserver('PHP_SELF')) .'?action=results&amp;number='. $Res1 .'&amp;results='. $results .'">'. $c .'</a>'."\n";
                            }
                        }
                    }

                    $RPages = ($phpfanpages * NUMBER);

                    $nump   = $nump + NUMBER;

                    if ($RPages == $nump)
                    {
                        $nav .= $phpfanpages .'&nbsp;';
                    }

                    if ($phpfanpages == 0)
                    {
                        $phpfanpages = 2;
                    } else {
                        $phpfanpages = $phpfanpages + 1;
                    }

                    for ($d=$phpfanpages,$e=$phpfanpages; $d < ($phpfanpages + 5); $d++,$e++)
                    {
                        $Res1 = (NUMBER * $e) - NUMBER;

                        if ($d != 1)
                        {
                            if (($TPages > ($e - 1)) && ($e != $SPages))
                            {
                                $nav .= '<a href="'. basename($this->getserver('PHP_SELF')) .'?action=results&amp;number='. $Res1 .'&amp;results='. $results .'">'. $e .'</a>&nbsp;';
                            }
                        }
                    }
                }

                if ($phpfanpages <= ($SPages - 6))
                {
                    $nav .= '...';
                }

                $Res1 = ($SPages * NUMBER) - NUMBER;

                if ($getnum != $Res1)
                {
                    $nav .= '<a href="'. basename($this->getserver('PHP_SELF')) .'?action=results&amp;number='. $Res1 .'&amp;results='. $results .'">'. $SPages .'</a>&nbsp;';
                }
            }

            return $nav;
        }
		
		function the_wordwrap($str)
		{
			$chars 	= preg_split('/(&#[^;\s]+;)|/', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
			$count	= count($chars);

			$x 		= 0;
			$final	= '';

			for ($i = 0; $i < $count; $i++)
			{
				$final	.= $chars[$i];

				if ($x == 40)
				{
					$final .= "<br />\n";
					$x = 0;
				}

				$x++;
			}

			return $final;
		}

        function check_url($url, $howlook, $howfast, $getbody = 0) /* private */
        {
            $res    = array();

            if (eregi('^http://', $url) || eregi('^https://', $url))
            {
                $urlArray = @parse_url($url);

                if (!$urlArray) return $res['code'] = 'Dead';

                if (function_exists('curl_init'))
                {
                    $ch = curl_init();
                    curl_setopt($ch, CURLOPT_URL, $url);

                    /* set the user agent - might help, doesn't hurt */
                    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');

                    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

                    /* try to follow redirects */
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

                    /* timeout after the specified number of seconds. assuming that this script runs on a server, 20 seconds should be plenty of time to verify a valid URL.  */
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $howfast);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 10);

                    /* don't download the page, just the header (much faster in this case) */

                    if ($getbody == 0)
                    {
                        curl_setopt($ch, CURLOPT_NOBODY, true);
                    }

                    curl_setopt($ch, CURLOPT_HEADER, true);

                    if ($getbody == 1)
                    {
                        curl_setopt($ch, CURLOPT_HTTPGET, true); //this is needed to fix the issue
                    }

                    curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');

                    /* handle HTTPS links */
                    if($urlArray['scheme']=='https')
                    {
                        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  1);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                    }

                    $response = curl_exec($ch);
                    curl_close($ch);

                    /*  get the status code from HTTP headers */
                    if (preg_match('/HTTP\/1\.\d+\s+(\d+)/', $response, $matches))
                    {
                        $res['code']    = intval($matches[1]);
                    } else {
                        $res['code']    = 'Dead';
                    }

                    if (preg_match('/(?i)\<title\s*\>([^<]+)\<\/title\s*\>/is', $response, $gettitle))
                    {
                        if (isset($gettitle[1]) && !empty($gettitle[1]))
                        {
                            $res['title'] = $this->clean($gettitle[1]);
                        }
                    }

                    $error = "[a-zA-Z ]*";
                    $message = "[;=':_.<>\(\)/a-zA-Z0-9 ]*";
                    $file = "[_.\(\)/a-zA-Z0-9 ]*";
                    $line = "[0-9]*";

                    if (ereg("<b>($error)</b>: ($message) in <b>($file)</b> on line <b>($line)</b>", $response, $matches))
                    {
                        $res['errorm'] = '<b>'. $matches[1] .'</b>: '. $matches[2] .' in '. $matches[4] .' on line <b>'. $matches[3] .'</b>';
                    }
                } else {
                    if (!isset($urlArray['port']))
                        $urlArray['port'] =  '80';
                    if (!isset($urlArray['path']))
                        $urlArray['path'] =  '/';

                        $sock = @fsockopen($urlArray['host'], $urlArray['port'], $errnum, $errstr, 5);
                    if (!$sock)
                        $res['code'] =  'Dead';
                    else
                    {
                        $query = '';
                        if (isset($urlArray['query']))
                        {
                            $query = '?'. $urlArray['query'];
                        }

                        $dump =  "GET ". $urlArray['path'] . $query ." HTTP/1.1\r\n";
                        $dump .=  "Host: ". $urlArray['host'] ."\r\n";
                        $dump .=  "Connection: close\r\n\r\n";


                        fputs($sock, $dump);

                        $str	= array();
						
						$bytes	= ($getbody == 1) ? 600 : 10; 

                        while (!feof($sock))
                        {
                            $str .= @fread($sock, $bytes);
                        }

                        fclose($sock);
                        flush();

						if (preg_match("/(http\/1\.[01]+)+ ([0-9]{3})/i", $str, $matches))
						{
							$res['code'] = trim($matches[2]);
						}

						if ($getbody == 1)
						{
	                        if (preg_match('/(?i)\<title\s*\>([^<]+)\<\/title\s*\>/is', $str, $gettitle))
	                        {

	                            if ((isset($gettitle[1])) != '')
	                            {
	                                $res['title'] = $this->clean($gettitle[1]);
	                            }
	                        }

	                        $error = "[a-zA-Z ]*";
	                        $message = "[;=':_.<>\(\)/a-zA-Z0-9 ]*";
	                        $file = "[_.\(\)/a-zA-Z0-9 ]*";
	                        $line = "[0-9]*";

	                        if (ereg("<b>($error)</b>: ($message) in <b>($file)</b> on line <b>($line)</b>", $str, $matches))
	                        {
	                            $res['errorm'] = '<b>'. $matches[1] .'</b>: '. $matches[2] .' in '. $matches[4] .' on line <b>'. $matches[3] .'</b>';
	                        }
						}
                    }
                }
            } else {
                $res['code'] = 'Dead';
            }

            return $res;
        }
    
        function checklinksphp()  /* PHP 4 constructor */
        {
            // call php5 constructor
            $args = func_get_args();
            call_user_func_array(array(&$this, '__construct'), $args);
        }
}
}


    if (!defined('PREFIX'))
    {
        define('PREFIX', $prefix);
    }

    if (!defined('NUMBER'))
    {
        define('NUMBER', $number);
    }

    include $lang_file;

    $everything                 = array();
    $everything['lang']         = (object)$main_lang;

    $func       = new checklinksphp($everything);

    $everything['getserver']    = $func->retserver();
    $everything['httpvars']     = $func->retget();

    $func->howfast          = $howfast;
    $func->howlook          = $howlook;
    $func->siteself         = $siteself;
    $func->days             = $days;
    $func->gettitle         = $gettitle;
    $func->getpost          = $func->retpost();

    if(strcmp(basename(urldecode($_SERVER['PHP_SELF'])),basename(__FILE__)) === 0)
    {
		$exist    = $func->db->query("SHOW TABLES LIKE '". PREFIX ."'");
		$x        = $func->db->num_rows;

		if ($x > 0)
		{
			$func->dolinkchecker();
		} else {
            include 'header.inc.php';
			echo $everything['lang']->lang_notinstalled;
            include 'footer.inc.php';
		}
    }

?>
Return current item: No404s