WordPress.org

Plugin Directory

Changeset 152760


Ignore:
Timestamp:
09/07/09 13:23:38 (5 years ago)
Author:
michelem
Message:

WassUp 1.7.2.1 release

Location:
wassup/trunk
Files:
2 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • wassup/trunk/lib/main.php

    r151501 r152760  
    503503    //  of whitespaces ...because it's shorter and more legible.  
    504504    //  -Helene D. 11/18/07 
    505     $input = attribute_escape(trim(stripslashes(rawurldecode(html_entity_decode($input)))," +\t")); //insecure 
    506  
    507     $inputlen=strlen($input); 
     505    $instring = trim(stripslashes(rawurldecode(html_entity_decode($input)))," +\t");    //insecure 
     506 
     507    $inputlen=strlen($instring); 
    508508    $max=(is_numeric($max))?(integer)$max:$inputlen; 
    509     if($max>=$inputlen){return $input;}; 
    510     $separator=($separator)?$separator:"(...)"; 
    511     $modulus=(($max%2)); 
    512     $halfMax=floor($max/2); 
    513     $begin=""; 
    514     if(!$modulus){$begin=substr($input, 0, $halfMax);} 
    515     else{$begin=(!$exceedFromEnd)? substr($input, 0, $halfMax+1) : substr($input, 0, $halfMax);} 
    516     $end=""; 
    517     if(!$modulus){$end=substr($input,$inputlen-$halfMax);} 
    518     else{$end=($exceedFromEnd)? substr($input,$inputlen-$halfMax-1) :substr($input,$inputlen-$halfMax);} 
    519     $extracted=substr( $input, strpos($input,$begin)+strlen($begin), $inputlen-$max ); 
    520     $outstring = $begin.$separator.$end; 
    521     if (strlen($outstring) >= $inputlen) {  //Because "Fir(...)fox" is longer than "Firefox" 
    522         $outstring = $input; 
    523     } 
    524     //# add WordPress 2.x function attribute_escape and 1.2.x function 
    525     //  wp_specialchars to make malicious code harmless when echoed to 
    526     //  the screen... 
    527     if (function_exists('attribute_escape')) { 
    528         return attribute_escape(wp_specialchars($outstring,ENT_QUOTES)); 
     509    //if($max>=$inputlen){return $input;};  //caused security loophole ...only $outstring should be returned 
     510    if ($max < $inputlen) { 
     511        $separator=($separator)?$separator:"(...)"; 
     512        $modulus=(($max%2)); 
     513        $halfMax=floor($max/2); 
     514        $begin=""; 
     515        if(!$modulus){$begin=substr($instring, 0, $halfMax);} 
     516        else{$begin=(!$exceedFromEnd)? substr($instring, 0, $halfMax+1) : substr($instring, 0, $halfMax);} 
     517        $end=""; 
     518        if(!$modulus){$end=substr($instring,$inputlen-$halfMax);} 
     519        else{$end=($exceedFromEnd)? substr($instring,$inputlen-$halfMax-1) :substr($instring,$inputlen-$halfMax);} 
     520        $extracted=substr($instring, strpos($instring,$begin)+strlen($begin), $inputlen-$max ); 
     521        $outstring = $begin.$separator.$end; 
     522        if (strlen($outstring) >= $inputlen) {  //Because "Fir(...)fox" is longer than "Firefox" 
     523            $outstring = $instring; 
     524        } 
     525        //# use WordPress 2.x function attribute_escape and 1.2.x  
     526        //  function wp_specialchars to make malicious code  
     527        //  harmless when echoed to the screen 
     528        $outstring=attribute_escape(wp_specialchars($outstring,ENT_QUOTES)); 
    529529    } else { 
    530         return addslashes(wp_specialchars($outstring,ENT_QUOTES)); 
    531     } 
    532 } 
     530        $outstring = attribute_escape(wp_specialchars($instring,ENT_QUOTES)); 
     531    } 
     532    return $outstring; 
     533} //end function stringShortener 
    533534 
    534535//# Return a value of true if url argument is a root url and false when 
     
    569570 
    570571//sanitize url of potentially dangerous code before display 
    571 function wCleanURL($url) {  
     572function wCleanURL($url="") {  
    572573    if (empty($url)) {  
    573574        return; 
    574575    } 
    575     $urlstring = stripslashes($url); 
     576    //$urlstring = stripslashes($url); 
    576577    if (function_exists('esc_url')) {   //#WP 2.8+ 
    577         $cleaned_url = esc_url($urlstring); 
     578        $cleaned_url = esc_url(stripslashes($url)); 
    578579    } else { 
    579         $cleaned_url = clean_url($urlstring); 
     580        $cleaned_url = clean_url(stripslashes($url)); 
    580581    } 
    581582    if (empty($cleaned_url)) {  //oops, clean_url chomp 
     
    676677 
    677678        // Start getting GEOIP info 
    678         // Start getting GEOIP info 
    679679           $location=""; 
    680680           $lat = 0; 
    681681           $lon = 0; 
    682682           if (function_exists('curl_init')) { 
    683             //TODO: save geo data in 'wassup_geoloc' table 
     683            //TODO: save geo data in 'wassup_tmp_geoloc' table 
    684684            //      so multi-page visits from save ip don't do 
    685685            //      redundant curl lookups 
     
    912912 
    913913    } else { 
    914         //check that wp_wassup.$stat_type column exist and is char 
     914        //TODO: check that wp_wassup.$stat_type column exist and is char 
    915915        if (!empty($stat_type)) { 
    916916            $stat_results = $wpdb->get_results("SELECT count($stat_type) AS top_count, `$stat_type` AS top_item FROM $table_name WHERE $stat_condition AND `$stat_type`!='' AND `$stat_type` NOT LIKE 'N/A%' GROUP BY `$stat_type` ORDER BY top_count DESC LIMIT $stat_limit"); 
  • wassup/trunk/readme.txt

    r151501 r152760  
    55Requires at least: 2.2 
    66Tested up to: 2.8.3 - 2.7.* - 2.6.* - 2.5.* - 2.3.* - 2.2.3 - 2.2.2 
    7 Stable tag: 1.7.2 
     7Stable tag: 1.7.2.1 
    88 
    99Analyze your visitors traffic with real time statistics, chart, a lot of chronological information and a sidebar Widget. 
  • wassup/trunk/wassup.php

    r151501 r152760  
    44Plugin URI: http://www.wpwp.org 
    55Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics. For Wordpress 2.2 or higher. 
    6 Version: 1.7.2 
     6Version: 1.7.2.1 
    77Author: Michele Marcucci, Helene D. 
    88Author URI: http://www.michelem.org/ 
     
    1818    die('Permission Denied! You are not allowed to call this page directly.'); 
    1919} 
    20 $wassupversion = "1.7.2"; 
     20$wassupversion = "1.7.2.1"; 
    2121$debug_mode=false;  //turns on debugging (global) 
    2222$wassupdir = dirname(__FILE__); 
     
    240240    if ($wassup_options->wassup_active == "1") { 
    241241        print '<meta name="wassup-version" content="'.$wassupversion.'" />'."\n"; 
    242     //if (!is_admin() || empty($current_user)) {  
    243242        //add screen resolution javascript to blog header 
    244243        if ($screen_res == "" && isset($_COOKIE['wassup_screen_res'])) { 
    245244            $screen_res = $_COOKIE['wassup_screen_res']; 
    246         } 
    247         if (empty($screen_res) && isset($_GET['wscr'])) { 
    248             $screen_res = $_GET['wscr']; 
    249         } 
    250         //if (empty($screen_res) && isset($_POST['wscr'])) { 
    251         //  $screen_res = $_POST['wscr']; 
     245            if (trim($screen_res) == "x") $screen_res=""; 
     246        } 
     247        if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) { 
     248            //resolution in IE/IEMobile header sometimes 
     249            $screen_res = str_replace('X','x',$_ENV['HTTP_UA_PIXELS']); 
     250        } 
     251        if (empty($screen_res) && isset($_COOKIE['wassup'])) { 
     252            $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($_COOKIE['wassup'])))); 
     253            $screen_res=(!empty($cookie_data[2]))?$cookie_data[2]:""; 
     254        } 
     255        //if (empty($screen_res) && isset($_GET['wscr'])) { 
     256        //  $screen_res = $_GET['wscr']; 
    252257        //} 
    253  
    254258    //Get visitor's screen resolution using javascript and a cookie. 
    255259    // - Added here so javascript code is placed in document <head>  
     
    259263//<![CDATA[ 
    260264    var screen_res = "<?php echo $screen_res; ?>"; 
    261 <?php   if (empty($screen_res) && !isset($_COOKIE['wassup_screen_res']) && !isset($_GET['wscr']) && !isset($_POST['wscr'])) { ?> 
    262     var screenwidth = screen.width; 
    263     var screenheight = screen.height; 
    264     if (screenwidth != "") { 
    265         screen_res = screenwidth + "x" + screenheight; 
    266     } 
    267     function writeCookie(cname,cvalue,chours) { 
    268         var the_cookie = cname + "=" + cvalue; 
    269         var ctime=chours*60*60*1000; //convert hours to microseconds 
    270         if (ctime > 0) { //0==expires on browser close 
    271             var expireDate = new Date(); 
    272             expireDate.setTime(expireDate.getTime()+ctime); 
    273             var expires = expireDate.toGMTString(); 
    274             the_cookie = the_cookie + "; expires=" + expires; 
    275         } 
    276 <?php       if (defined('COOKIE_DOMAIN')) { 
     265<?php   if (empty($screen_res) && !isset($_COOKIE['wassup_screen_res'])) { ?> 
     266    function writeCookie(name,value,hours) { 
     267        var the_cookie = name+"="+value+"; expires="; 
     268        var expires = ""; 
     269        hours=hours+0; //convert to number 
     270        if (hours > 0) { //0==expires on browser close 
     271            var date = new Date(); 
     272            date.setTime(date.getTime()+(hours*60*60*1000)); 
     273            expires = expires+date.toGMTString(); 
     274        }  
     275    <?php   if (defined('COOKIE_DOMAIN')) { 
    277276            $cookiedomain = COOKIE_DOMAIN; 
    278277            $cookiepath = "/"; 
    279278        } else { 
    280279            $cookieurl = parse_url(get_option('home')); 
    281             $cookiedomain = preg_replace('/^www\./i','',$cookieurl['host']); 
     280            $cookiedomain = preg_replace('/^www\./','',$cookieurl['host']); 
    282281            $cookiepath = $cookieurl['path']; 
    283282        } 
    284         if (!empty($cookiedomain)) { 
    285             if (!empty($cookiepath)) { 
    286                 echo "\t".'the_cookie = the_cookie + "; domain='.$cookiedomain.'"; path='.$cookiepath.'";'; 
    287             } else { 
    288                 echo "\t".'the_cookie = the_cookie + "; domain='.$cookiedomain.'";'; 
    289             } 
    290         } 
    291         echo "\n\t\tdocument.cookie = the_cookie;\n"; ?> 
    292     } 
     283        echo "\t".'document.cookie = the_cookie+expires+"; path='.$cookiepath.'; domain='.$cookiedomain.'";'."\n"; ?> 
     284    } 
     285    screen_res = window.screen.width+"x"+window.screen.height; 
     286    writeCookie("wassup_screen_res",screen_res,"48"); //keep 2 days 
    293287<?php    
    294     // If visitor stays online, try a page reload after 40 seconds so  
    295     //  WassUp (PHP) can read and record screen resolution. In case  
    296     //  cookie is rejected, screen resolution is also assigned as GET 
    297     //  parameter, 'wscr', and included on request line.  ?> 
    298     function resolution_reload() { 
     288    // *DISABLED*  because inflates the number of visitor page views 
     289    // if (!isset($_GET['wscr']) && !isset($_COOKIE['wassup'])) { 
     290    //  In case cookie is rejected, screen resolution is assigned as  
     291    //  GET parameter, 'wscr', and included on request line. ? > 
     292    /* function resolution_reload() { 
    299293        if (screen_res != "") { 
    300             var reload_url="<?php 
     294            var reload_url="< ? php 
    301295            if (empty($_SERVER['QUERY_STRING'])) { 
    302296                echo $_SERVER['REQUEST_URI'].'?wscr='; 
    303297            } else { 
    304298                echo $_SERVER['REQUEST_URI'].'&wscr='; 
    305             } ?>"+screen_res; 
     299            } ? >"+screen_res; 
    306300            location.replace(reload_url); 
    307301        } 
    308302    }  
    309     writeCookie("wassup_screen_res",screen_res,"48"); //keep 2 days 
    310 <?php    
     303    */ 
    311304    //reload page after timeout of 40 seconds with 'wscr' param set (browsers only, no spiders) 
    312     if (preg_match('/(?:Opera|Gecko|Webkit|MSIE)/i',$_SERVER['HTTP_USER_AGENT'])>0 && !is_user_logged_in()) {  
    313         echo "\t".'if (screen_res != "")'; 
    314         echo "\n\t\t".'setTimeout("resolution_reload()",40000);'."\n"; 
    315     } 
    316     ?> 
    317 <?php   //} else {  
    318     //var screen_res = "<?php if (isset($_COOKIE['wassup_screen_res'])) { echo $_COOKIE['wassup_screen_res']; } elseif (isset($_GET['wscr'])) { echo $_GET['wscr']; } 
    319     }  //end if empty($screen_res) ?> 
     305    /* if (empty($screen_res) && preg_match('/(?:Opera|Gecko|Webkit|MSIE\s[78])/i',$_SERVER['HTTP_USER_AGENT'])>0 && !is_user_logged_in()) { ? > 
     306    if (screen_res != "") setTimeout("resolution_reload()",40000); 
     307    } */ 
     308    //} //end if !isset 'wscr' 
     309    } //end if !isset('wassup_screen_res') ?> 
    320310//]]> 
    321311</script> 
    322  
    323 <?php   //} //end if !is_admin 
     312<?php    
    324313    } // end if wassup_active == "1" 
    325314} //end function wassup_meta_info 
     
    382371    global $wpurl, $wassup_options, $whash, $debug_mode; 
    383372 
    384     $plugin_page = attribute_escape($_GET['page']); 
     373    $plugin_page = $_GET['page']; 
    385374    if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; } 
    386375    //Add css and javascript to wassup menu pages only... 
     
    436425  } 
    437426  function CountDownTick() { 
    438         //SetCountdownText(_currentSeconds-1); 
    439     //window.setTimeout("CountDownTick()", 1000); //replaced by setInterval in ActivateCountDown 
    440427    if (_currentSeconds > 0) {      //don't tick below zero 
    441428            SetCountdownText(_currentSeconds-1); 
     
    663650     
    664651    // Start getting time of execution to debug SQL query 
    665     //$mtime = microtime(); 
    666     //$mtime = explode(" ",$mtime); 
    667652    $starttime = microtime_float(); 
    668     // This could be commented out 
    669653 
    670654    //#debug... 
     
    15971581        <?php  
    15981582        if ($numurl > 1) { 
    1599             //$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`"); 
    1600             //$qryCD = $wpdb->get_results("SELECT DISTINCT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`");  //no duplications 
    1601             $qryCD = $wpdb->get_results("SELECT `id`, `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `id`");  //id is sequential, so sort order == visit order 
     1583            //Important Note: list of urls visited is affected by browsers like Safari 4 which hits a page from both the user window and from it's "top sites" page, creating multiple duplicate records with distinct id's... 
     1584            //$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`");   //duplicates possible 
     1585            $qryCD = $wpdb->get_results("SELECT DISTINCT `timestamp`, urlrequested, agent FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`"); //no duplication, unless agent is differnt 
     1586            //$qryCD = $wpdb->get_results("SELECT `id`, `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `id`");    //id is sequential, so sort order == visit order...UPDATE: may not be in visit order because 'insert delayed' could make `id` out of sync with `timestamp` 
    16021587            $i=1; 
    16031588            $char_len = round($max_char_len*.92,0); 
     
    17051690 
    17061691    //wassup table structure 
    1707         $sql_createtable = "CREATE TABLE $table_name ( 
    1708   id mediumint(9) NOT NULL auto_increment, 
    1709   wassup_id varchar(60) NOT NULL, 
    1710   timestamp varchar(20) NOT NULL, 
    1711   ip varchar(35) default NULL, 
    1712   hostname varchar(150) default NULL, 
    1713   urlrequested text, 
    1714   agent varchar(255) default NULL, 
    1715   referrer text default NULL, 
    1716   search varchar(255) default NULL, 
    1717   searchpage int(11) default 0, 
    1718   os varchar(15) default NULL, 
    1719   browser varchar(50) default NULL, 
    1720   language varchar(5) default NULL, 
    1721   screen_res varchar(15) default NULL, 
    1722   searchengine varchar(25) default NULL, 
    1723   spider varchar(50) default NULL, 
    1724   feed varchar(50) default NULL, 
    1725   username  VARCHAR(50) default NULL, 
    1726   comment_author VARCHAR(50) default NULL, 
    1727   spam VARCHAR(5) default 0, 
    1728   UNIQUE KEY id (id), 
    1729   KEY idx_wassup (wassup_id(32),timestamp), 
    1730   INDEX (os), 
    1731   INDEX (browser), 
    1732   INDEX (timestamp)) {$charset_collate};"; 
     1692    $sql_createtable = "CREATE TABLE `$table_name` ( 
     1693  `id` mediumint(9) unsigned NOT NULL auto_increment, 
     1694  `wassup_id` varchar(60) NOT NULL, 
     1695  `timestamp` varchar(20) NOT NULL, 
     1696  `ip` varchar(35) default NULL, 
     1697  `hostname` varchar(150) default NULL, 
     1698  `urlrequested` text, 
     1699  `agent` varchar(255) default NULL, 
     1700  `referrer` text, 
     1701  `search` varchar(255) default NULL, 
     1702  `searchpage` int(11) unsigned default '0', 
     1703  `os` varchar(15) default NULL, 
     1704  `browser` varchar(50) default NULL, 
     1705  `language` varchar(5) default NULL, 
     1706  `screen_res` varchar(15) default NULL, 
     1707  `searchengine` varchar(25) default NULL, 
     1708  `spider` varchar(50) default NULL, 
     1709  `feed` varchar(50) default NULL, 
     1710  `username` varchar(50) default NULL, 
     1711  `comment_author` varchar(50) default NULL, 
     1712  `spam` varchar(5) default '0', 
     1713  `url_wpid` varchar(50) default NULL, 
     1714  UNIQUE KEY `id` (`id`), 
     1715  KEY `idx_wassup` (`wassup_id`(32),`timestamp`), 
     1716  INDEX (`os`), 
     1717  INDEX (`browser`), 
     1718  INDEX `timestamp` (`timestamp`)) {$charset_collate};"; 
    17331719    //  Note: index (username,ip) has been removed because of problems 
    17341720    //    with non-romanic language display 
     
    19061892    $cookieIP = ""; 
    19071893    $cookieHost = ""; 
     1894    $cookie_value=""; 
    19081895    if (empty($current_user->user_login)) {  
    19091896        get_currentuserinfo();  //sets $current_user, $user_xx  
     
    19201907    if (isset($_COOKIE['wassup'])) { 
    19211908        $cookie_value = $_COOKIE['wassup']; 
    1922         $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($cookie_value)))); 
     1909        $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($_COOKIE['wassup'])))); 
    19231910        $wassup_id = $cookie_data[0]; 
    19241911        if (!empty($cookie_data[1])) {  
     
    19281915        if (!empty($cookie_data[2])) {  
    19291916            $screen_res = $cookie_data[2]; 
    1930         } elseif (isset($_COOKIE['wassup_screen_res'])) { 
    1931             $screen_res = $_COOKIE['wassup_screen_res']; 
    1932         } elseif (isset($_GET['wscr'])) { 
    1933             $screen_res = $_GET['wscr']; 
    1934         } 
    1935  
     1917        } 
    19361918        if (!empty($cookie_data[3])) { 
    19371919            $cookieIP = $cookie_data[3]; 
     
    19411923        } 
    19421924    } 
    1943     //Assign a value to screen res based on GET or POST values, if any 
    1944     if (empty($wassup_id) || $session_timeout < 1) { 
     1925    //set screen resolution value from cookie or browser header data, if any 
     1926    if (empty($screen_res)) { 
     1927        if (isset($_COOKIE['wassup_screen_res'])) { 
     1928            $screen_res = $_COOKIE['wassup_screen_res']; 
     1929            if (trim($screen_res) == "x") $screen_res=""; 
     1930        }  
     1931        if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) { 
     1932            //resolution in IE/IEMobile header sometimes 
     1933            $screen_res = str_replace('X','x',$_ENV['HTTP_UA_PIXELS']); 
     1934        } 
     1935        //if (empty($screen_res) && isset($_GET['wscr'])) { 
     1936        //  $screen_res = $_GET['wscr']; 
     1937        //}  
     1938    } 
     1939    //write wassup cookie for new visits, visit timeout (45 mins) or empty screen_res 
     1940    if (empty($wassup_id) || $session_timeout < 1 || (empty($cookie_data[2]) && !empty($screen_res))) { 
    19451941        $ipAddress = ""; 
    19461942        $hostname = ""; 
     
    20142010        setcookie("wassup", "$cookie_value", $expire, $cookiepath, $cookiedomain); 
    20152011    } //end if empty(wassup_id) 
    2016         //place wassup tag in document head 
    2017         add_action('wp_head', 'wassup_meta_info', $screen_res); 
    2018         if ($debug_mode) { 
    2019             //show wassupAppend debug output in footer when in debug mode 
    2020             add_action('wp_footer', 'wassupAppend', $cookie_value); 
    2021         } else { 
    2022             //add visit record after page is displayed to keep page load fast 
    2023             add_action('shutdown', 'wassupAppend', $cookie_value); 
    2024         } 
     2012 
     2013    //place wassup tag and javascript in document head and footer 
     2014    add_action('wp_head', 'wassup_meta_info', 10, "$screen_res"); 
     2015 
     2016    //record visit after page is displayed to keep page load fast 
     2017    if ($debug_mode) { 
     2018        //show wassupAppend debug output in footer when in debug mode 
     2019        //...15-priority so runs after other wp_footer actions 
     2020        add_action('wp_footer', 'wassupAppend', 15, "$cookie_value"); 
     2021    } else { 
     2022        //add visit record after page is displayed to keep page load fast 
     2023        //...1-priority so runs before other 'shutdown' actions such as cache flush 
     2024        add_action('shutdown', 'wassupAppend', 1, "$cookie_value"); 
     2025        //Warning Note: since Wordpress 2.7.1, 'shutdown' hook causes sporadic inclusion of non-visited posts in wassup table for some wordpress themes 
     2026    } 
    20252027 
    20262028    } //end if !is_admin 
     
    20862088        if (!empty($wassup_options->wassup_exclude_url) && !$exclude_visit) { 
    20872089            $exclude_list = explode(",", $wassup_options->wassup_exclude_url); 
    2088             $pagerequest=strtolower($urlRequested); 
     2090            $pagerequest=strtolower(remove_query_arg('wscr',$urlRequested)); 
    20892091            foreach ($exclude_list as $exclude_url) { 
    20902092                $exclude_page = strtolower($exclude_url); 
     
    21182120            if (!empty($wassup_cookie[2])) {  
    21192121                $screen_res = $wassup_cookie[2]; 
    2120             } elseif (isset($_COOKIE['wassup_screen_res'])) { 
    2121                 $screen_res = $_COOKIE['wassup_screen_res']; 
    2122             } elseif (isset($_GET['wscr'])) { 
    2123                 $screen_res = $_GET['wscr']; 
    21242122            } 
    21252123            if (!empty($wassup_cookie[3])) { 
     
    21292127                } 
    21302128            } 
     2129        } 
     2130        //### set screen resolution value from cookie or browser header data, if any 
     2131        if (empty($screen_res)) { 
     2132            if (isset($_COOKIE['wassup_screen_res'])) { 
     2133                $screen_res = attribute_escape($_COOKIE['wassup_screen_res']); 
     2134            }  
     2135            if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) { 
     2136                //resolution in IE/IEMobile header sometimes 
     2137                $screen_res = str_replace('X','x',attribute_escape($_ENV['HTTP_UA_PIXELS'])); 
     2138            } 
     2139            //if (empty($screen_res) && isset($_GET['wscr'])) { 
     2140            //  $screen_res = attribute_escape($_GET['wscr']); 
     2141            //}  
    21312142        } 
    21322143        //#### Get the visitor's details from http header... 
     
    22382249    if (!empty($recent)) { 
    22392250        //check 1st record only 
    2240         //record is dup is same url and user-agent 
    2241         if ($recent[0]->urlrequested == $urlRequested && $recent[0]->agent == $userAgent) { 
    2242             $dup_urlrequest=1; 
     2251        //record is dup if same url (with 'wscr' removed) and same user-agent 
     2252        if ($recent[0]->urlrequested == $urlRequested || $recent[0]->urlrequested == remove_query_arg('wscr',$urlRequested)) { 
     2253            if ($recent[0]->agent == $userAgent || empty($recent[0]->agent)) { 
     2254                $dup_urlrequest=1; 
     2255            } 
    22432256        } 
    22442257        //retrieve previous spam check results 
     
    22792292            if ($recent[0]->agent != $userAgent) { 
    22802293                echo "\nUser Agents NOT Identical:"; 
    2281                 echo "\n\tCurrent user agent: ".attribute_escape($userAgent); 
     2294                echo "\n\tCurrent user agent: ".$userAgent; 
    22822295                echo "\n\tPrevious user agent: $recent[0]->agent\n"; 
    22832296            } 
     
    23172330            $os = $ua->os; 
    23182331            if (!empty($ua->resolution)) { 
     2332                //TODO?: Write 'wassup_screen_res' cookie, if none 
    23192333                $screen_res = $ua->resolution; 
    23202334            } 
     
    24992513            } 
    25002514            if (!empty($searchengine)) { 
    2501                 if (empty($searchcountry)) { 
     2515                if (empty($searchcountry) && preg_match('/([a-z]\.)+/i',$searchdomain)) { 
    25022516                    $secountry = explode(".", $searchdomain); 
    25032517                    if (!empty($secountry[4])) { 
     
    25052519                        if ($clength == 2) { 
    25062520                                $searchcountry = $secountry[4]; 
    2507                         } elseif (strlen($secountry[1])==2 && $clength >2) { 
    2508                                 $searchcountry = $secountry[1]; 
     2521                        } elseif (strlen($secountry[0])==2 && $clength >2) { 
     2522                                $searchcountry = $secountry[0]; 
    25092523                        } 
    25102524                    } elseif (!empty($secountry[3])) { 
     
    25122526                        if ($clength == 2) { 
    25132527                                $searchcountry = $secountry[3]; 
    2514                         } elseif (strlen($secountry[1])==2 && $clength >2) { 
    2515                                 $searchcountry = $secountry[1]; 
     2528                        } elseif (strlen($secountry[0])==2 && $clength >2) { 
     2529                                $searchcountry = $secountry[0]; 
    25162530                        } 
    25172531                    } elseif ($searchcountry[2] != '' && strlen($secountry[2]) == 2) { 
Note: See TracChangeset for help on using the changeset viewer.