Changeset 5121

Show
Ignore:
Timestamp:
02/13/06 11:36:11 (2 years ago)
Author:
GamerZ
Message:

Some Bug Fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-useronline/trunk/readme.txt

    r5011 r5121  
    1212// Version 2.02 (01-03-2006) 
    1313- NEW: No More Install/Upgrade File, It Will Install/Upgrade When You Activate The Plugin. 
     14- FIXED: IP 'Unknown' Error, Credit To Brian Layman (http://www.knitchat.com/) 
     15- FIXED: ON DUPLICATE KEY Error, Credit To Brian Layman (http://www.knitchat.com/) 
    1416 
    1517// Version 2.01 (01-02-2006) 
  • wp-useronline/trunk/useronline.php

    r5011 r5121  
    3333 
    3434### Search Bots Name 
    35 $bots = array('Google Bot' => 'googlebot', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'ubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot'); 
     35$bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'ubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com bot' => 'become.com', 'Technorati Blog Bot'=>'technorati'); 
    3636 
    3737 
     
    9393      } 
    9494      $make_page = addslashes($make_page); 
    95  
    96       // Update User First 
    97       $update_user = $wpdb->query("UPDATE $wpdb->useronline SET timestamp = '$timestamp', ip = '$ip', location = '$make_page', url = '$url' $where"); 
    98  
    99       // If No Such User Insert It 
    100       if(!$update_user) { 
    101             $insert_user = $wpdb->query("INSERT INTO $wpdb->useronline VALUES ('".($timestamp+1)."', '$memberonline', '$ip', '$make_page', '$url')"); 
     95       
     96      // Check User First 
     97      $check_user = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline $where"));     
     98 
     99      // If User Exists, Update User 
     100      if($check_user > 0) { 
     101            $update_user = $wpdb->query("UPDATE $wpdb->useronline SET timestamp = '$timestamp', ip = '$ip', location = '$make_page', url = '$url' $where");        
     102      // Else Insert User 
     103      } else { 
     104            $insert_user = $wpdb->query("INSERT INTO $wpdb->useronline VALUES ('$timestamp', '$memberonline', '$ip', '$make_page', '$url')"); 
    102105      } 
    103106 
     
    136139 
    137140### Function: Display Max UserOnline 
    138 function get_most_useronline($display = true) { 
    139       $most_useronline_users = intval(get_settings('useronline_most_users')); 
    140       if($display) { 
    141             echo $most_useronline_users; 
    142       } else { 
    143             return $most_useronline_users; 
     141if(!function_exists('get_most_useronline')) { 
     142      function get_most_useronline($display = true) { 
     143            $most_useronline_users = intval(get_settings('useronline_most_users')); 
     144            if($display) { 
     145                  echo $most_useronline_users; 
     146            } else { 
     147                  return $most_useronline_users; 
     148            } 
    144149      } 
    145150} 
     
    147152 
    148153### Function: Display Max UserOnline Date 
    149 function get_most_useronline_date($date_format = 'jS F Y, H:i', $display =true) { 
    150       $most_useronline_timestamp = get_settings('useronline_most_timestamp'); 
    151       $most_useronline_date = gmdate($date_format, $most_useronline_timestamp); 
    152       if($display) { 
    153             echo $most_useronline_date; 
    154       } else { 
    155             return$most_useronline_date; 
     154if(!function_exists('get_most_useronline_date')) { 
     155      function get_most_useronline_date($date_format = 'jS F Y, H:i', $display =true) { 
     156            $most_useronline_timestamp = get_settings('useronline_most_timestamp'); 
     157            $most_useronline_date = gmdate($date_format, $most_useronline_timestamp); 
     158            if($display) { 
     159                  echo $most_useronline_date; 
     160            } else { 
     161                  return$most_useronline_date; 
     162            } 
    156163      } 
    157164} 
     
    247254                                      " location varchar(255) NOT NULL default '',". 
    248255                                      " url varchar(255) NOT NULL default '',". 
    249                                       " UNIQUE KEY (timestamp))"; 
     256                                      " PRIMARY KEY (timestamp))"; 
    250257      maybe_create_table($wpdb->useronline, $create_table); 
    251258      // Add In Options 
  • wp-useronline/trunk/wp-useronline.php

    r5011 r5121  
    9797### Function: Check IP 
    9898function check_ip($ip) { 
    99       if(!empty($_COOKIE[USER_COOKIE])) { 
     99      if(!empty($_COOKIE[USER_COOKIE]) && ($ip != 'unknown')) { 
    100100            return "(<a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=$ip\" target=\"_blank\" title=\"".gethostbyaddr($ip)."\">$ip</a>)"; 
    101101      }