Changeset 95

Show
Ignore:
Timestamp:
02/20/08 10:28:06 (9 months ago)
Author:
root
Message:

added user agent string

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/action.php

    r94 r95  
    6565        // ACTION: RUN TOP TEN 
    6666        } elseif ($_GET['action'] == "topten") { 
     67                $siteurl = parse_url($siteurl); 
     68                $siteurl = $siteurl['host']; 
    6769                //#get top 10 searches... 
    68                 $ch_search = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE search!='' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY search ORDER BY top_search DESC LIMIT 10"); 
     70                $ch_search = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE search!='' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY search ORDER BY top_search DESC LIMIT 10"); 
    6971                //#get top 10 requests... 
    70                 $ch_urlreq = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE urlrequested!='' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY urlrequested ORDER BY top_urlrequested DESC LIMIT 10"); 
     72                $ch_urlreq = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE urlrequested!='' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY urlrequested ORDER BY top_urlrequested DESC LIMIT 10"); 
    7173                //#get top 50 referrers...will be narrowed down to 10  
    7274                //#  with exclusion of wpurl referrals... 
    73                 $ch_referer = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE referrer!='' AND spam='0' AND referrer NOT LIKE '%".$siteurl."%' AND searchengine='' AND timestamp BETWEEN $from_date AND $to_date GROUP BY referrer ORDER BY top_referrer DESC LIMIT 50"); 
     75                $ch_referer = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE referrer!='' AND spam=0 AND referrer NOT LIKE '%".$siteurl."%' AND searchengine='' AND timestamp BETWEEN $from_date AND $to_date GROUP BY referrer ORDER BY top_referrer DESC LIMIT 50"); 
    7476                //#get top 10 browsers... 
    75                 $ch_browser = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND spam='0' AND browser NOT LIKE '%N/A%' AND timestamp BETWEEN $from_date AND $to_date GROUP BY browser ORDER BY top_browser DESC LIMIT 10"); 
     77                $ch_browser = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND spam=0 AND browser NOT LIKE '%N/A%' AND timestamp BETWEEN $from_date AND $to_date GROUP BY browser ORDER BY top_browser DESC LIMIT 10"); 
    7678                //#get top 10 operating systems... 
    77                 $ch_os = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' AND spam='0' AND timestamp BETWEEN $from_date AND $to_date GROUP BY os ORDER BY top_os DESC LIMIT 10"); 
     79                $ch_os = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '%N/A%' AND spam=0 AND timestamp BETWEEN $from_date AND $to_date GROUP BY os ORDER BY top_os DESC LIMIT 10"); 
    7880        ?> 
    7981<div> 
  • trunk/lib/main.php

    r86 r95  
    306306                        } elseif (preg_match("/(?:Windows95|Windows 95|Win95|Win 95)/",$useragent,$match)) { 
    307307                                $os = "Windows"; $version = "95"; 
    308                         } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98)/",$useragent,$match)) { 
     308                        } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98|Win 9x)/",$useragent,$match)) { 
    309309                                $os = "Windows"; $version = "98"; 
    310310                        } elseif (preg_match("/(?:WindowsCE|Windows CE|WinCE|Win CE)/",$useragent,$match)) { 
     
    354354                        } elseif (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) { 
    355355                                $browser = "MSIE"; 
    356                         } elseif (preg_match("/^Mozilla(?:.*)\(Macintosh(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) { 
     356                        } elseif (preg_match("/^(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) { 
     357                                $browser = "MSIE"; 
     358                        } elseif (preg_match("/^Mozilla(?:.*)(?:.*)Safari/",$useragent,$match)) { 
    357359                                $browser = "Safari"; 
     360                        //} elseif (preg_match("/^Mozilla(?:.*)\(Windows(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) { 
     361                        //      $browser = "Safari"; 
    358362                        } elseif (preg_match("/^Mozilla(?:.*)\(Macintosh(?:.*)OmniWeb\/v([0-9\.]+)/",$useragent,$match)) { 
    359363                                $browser = "Omniweb"; 
  • trunk/wassup.php

    r94 r95  
    10591059 
    10601060        if (isset($_SERVER['REQUEST_URI']) && !ereg("^/$", $_SERVER['REQUEST_URI'])) {  
    1061                 $urlRequested = eregi_replace("/$", "", $_SERVER['REQUEST_URI']); 
     1061                $urlRequested = eregi_replace("/$", "", clean_url($_SERVER['REQUEST_URI'])); 
    10621062        } else { 
    1063                 $urlRequested = $_SERVER['REQUEST_URI']; 
     1063                $urlRequested = clean_url($_SERVER['REQUEST_URI']); 
    10641064        } 
    10651065        $referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''); 
     
    14821482function wGetSE($referrer = null){ 
    14831483        $key = null; 
    1484         $lines = array("Alice|search.alice.it|qs|","Google|www.google.|q|","Google Groups|groups.google.|q|", "Google Images|images.google.|prev|", "Yahoo|search.yahoo.com|p|",  
     1484        $lines = array("Alice|search.alice.it|qs|", "Google|www.google.|as_q|", "Google|www.google.|q|", "Google Groups|groups.google.|q|",  
     1485                        "Google Images|images.google.|prev|", "Yahoo|search.yahoo.com|p|", "Google Blog|blogsearch.google.|as_q|", "Google Blog|blogsearch.google.|q|", 
    14851486                        "Virgilio|search.virgilio.it|qs|","Arianna|arianna.libero.it|query|","Altavista|.altavista.com|q|","Kataweb|kataweb.it|q|", 
    14861487                        "Il Trovatore|categorie.iltrovatore.it|query|","Il Trovatore|search.iltrovatore.it|q|","2020Search|2020search.c|us|st|pn|1|", 
     
    14931494                        "Web|web.de|su|","Clarence|search.clarence.com|q|","Gazzetta|search.gazzetta.it|q|","PagineGialle|paginegialle.it|qs|", 
    14941495                        "Jumpy|servizi.mediaset.it|searchWord|","ItaliaPuntoNet|italiapuntonet.net|search|","StartNow|search.startnow.|q|","Search|search.it|srctxt|", 
    1495                         "Search|search.com|q|"); 
     1496                        "Search|search.com|q|", "Good Search|goodsearch.com|Keywords|"); 
    14961497        foreach($lines as $line_num => $se) { 
    14971498                list($nome,$url,$key,$lang)=explode("|",$se); 
     
    15261527                        "ichiro|ichiro|", "shelob|shelob|", "Google AdSense|Mediapartners-Google|", "Seekbot|HTTPFetcher|", "CommentTracker|CommentTracker|",  
    15271528                        "Bloglines|bloglines|", "Italian Blog Rankings|blogbabel", "Ask Jeeves/Teoma|ask|", "Akregator|Akregator|", "NewsGatorOnline|NewsGatorOnline|", "Rojo|rojo|", "FeedTools|feedtools|", 
    1528                         "Feedfetcher-Google|Feedfetcher-google|", "AideRSS|AideRSS|", "psbot|psbot|", "Ruby|Rfeedfinder|", "everyfeed-spider|everyfeed-spider", "Attentio/Nutch|Attentio",  
     1529                        "Feedfetcher-Google|Feedfetcher-google|", "AideRSS|AideRSS|", "psbot|psbot|", "Ruby|Rfeedfinder|", "everyfeed-spider|everyfeed-spider", "Attentio/Nutch|Attention",  
    15291530                        "Megite2.0|Megite.com|", "radianrss|RadianRSS|", "Sitemap Generator|Sitemap Generator|", "Feedshow|Feedshow|", "ABCdatos|ABCdatos|", "Acme.Spider|Due|", "Ahoy!|Ahoy!|",  
    15301531                        "Alkaline|AlkalineBOT|", "appie|Appie|", "Arachnophilia|Arachnophilia|", "Araneo|Araneo/0.7|", "AraybOt|AraybOt/1.0|", "ArchitextSpider|ArchitextSpider|",  
     
    15731574                        "WikioFeedBot|WikioFeedBot|", "Strategic Board Bot |Strategic Board Bot |", "Mail.ru|Mail.ru|", "OpiDig|OpiDig|", "webcollage|webcollage|",  
    15741575                        "R6_FeedFetcher|R6_FeedFetcher|", "UniversalFeedParser|UniversalFeedParser|", "Syndic8|Syndic8|", "BlogBot|BlogBot|", "W3C_Validator|W3C_Validator|", 
    1575                         "Runnk RSS aggregator|Runnk|", "RssBandit|RssBandit|"); 
     1576                        "Runnk RSS aggregator|Runnk|", "RssBandit|RssBandit|", "Sphere Scout|Sphere Scout|", "BlogPulseLive|BlogPulseLive|", "AMZNKAssocBot|AMZNKAssocBot|", 
     1577                        "Yandex|Yandex|", "heritrix|heritrix|", "gsinfobot|gsinfobot|", "FeedHub FeedFetcher|FeedHub FeedFetcher|", "WikioPxyFeedBo|WikioPxyFeedBo|", 
     1578                        "KindOpener|KindOpener|", "AlbertBot|AlbertBot|", "Nutch/Nutch|Nutch/Nutch|", "Lsearch/sondeur|Lsearch/sondeur|", "OWPBot|OWPBot|",  
     1579                        "Feed::Find|Feed::Find|", "eZ publish Link Validator|eZ publish Link Validator|", "R6_CommentReade|R6_CommentReade|",  
     1580                        "Strategic Board Bot|Strategic Board Bot|", "OSSE Scanner|OSSE Scanner|", "PECL::HTTP|PECL::HTTP|", "GetRight|GetRight|", "yacybot|yacybot|", 
     1581                        "GurujiBot|GurujiBot|", "Missigua Locator|Missigua Locator|", "ISC Systems iRc Search|ISC Systems iRc Search|", "whiteiexpres/Nutch|whiteiexpres/Nutch|", 
     1582                        "kalooga/kalooga|kalooga/kalooga|", "Bookdog|Bookdog|"); 
    15761583        foreach($lines as $line_num => $spider) { 
    15771584                list($nome,$key)=explode("|",$spider); 
     
    18081815} // end backup_table() 
    18091816 
     1817// START initializing Widget 
    18101818function wassup_widget_init() { 
    18111819 
     
    18391847                print "<ul class='$ulclass'>"; 
    18401848                foreach ($query_det as $sref) { 
    1841                         print "<li>- <a href='".htmlentities($sref->referrer)."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>"; 
     1849                        print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>"; 
    18421850                } 
    18431851                print "</ul>"; 
     
    18521860                print "<ul class='$ulclass'>"; 
    18531861                foreach ($query_ref as $eref) { 
    1854                         print "<li>- <a href='".htmlentities($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", htmlentities($eref->referrer)), $chars)."</a></li>"; 
     1862                        print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", attribute_escape($eref->referrer)), $chars)."</a></li>"; 
    18551863                } 
    18561864                print "</ul>"; 
     
    19952003                print "<ul class='$ulclass'>"; 
    19962004                foreach ($query_det as $sref) { 
    1997                         print "<li>- <a href='".$sref->referrer."' target='_BLANK'>".stringShortener($sref->search, $chars)."</a></li>"; 
     2005                        print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_BLANK'>".stringShortener(attribute_escape($sref->search), $chars)."</a></li>"; 
    19982006                } 
    19992007                print "</ul>"; 
     
    20072015                print "<ul class='$ulclass'>"; 
    20082016                foreach ($query_ref as $eref) { 
    2009                         print "<li>- <a href='".$eref->referrer."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", $eref->referrer), $chars)."</a></li>"; 
     2017                        print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_BLANK'>".stringShortener(eregi_replace("http://", "", attribute_escape($eref->referrer)), $chars)."</a></li>"; 
    20102018                } 
    20112019                print "</ul>"; 
     
    20192027                print "<ul class='$ulclass'>"; 
    20202028                foreach ($query_topbr as $etopbr) { 
    2021                         print "<li>- ".stringShortener($etopbr->browser, $chars)."</li>"; 
     2029                        print "<li>- ".stringShortener(attribute_escape($etopbr->browser), $chars)."</li>"; 
    20222030                } 
    20232031                print "</ul>"; 
     
    20312039                print "<ul class='$ulclass'>"; 
    20322040                foreach ($query_topos as $etopos) { 
    2033                         print "<li>- ".stringShortener($etopos->os, $chars)."</li>"; 
     2041                        print "<li>- ".stringShortener(attribute_escape($etopos->os), $chars)."</li>"; 
    20342042                } 
    20352043                print "</ul>";