View Single Post
  #12  
Unread 25th February, 2007, 12:00 PM
Azazel's Avatar
Azazel Azazel is offline
Administrator
 
Join Date: Jul 2002
Location: UK
Posts: 2,408
Default

Indeed, thats what you get for coding after 2 bottles of wine

Try this instead:

PHP Code:
<?
//include config & functions from the stats
include_once("includes/config.php");
include_once(
"includes/functions.php");

// Query for list of ids where country = xx and player has an IP
$sql_pipcheck "SELECT DISTINCT pid, country, ip FROM uts_player WHERE country = 'xx' AND ip > 0";

$q_pipcheck mysql_query($sql_pipcheck) or die(mysql_error());
while (
$r_pipcheck mysql_fetch_array($q_pipcheck)) {
    
    
$playerid $r_pipcheck[pid];
    
$playerip $r_pipcheck[ip];
    
     
// Check the players IP against the country database and update record if a country is found
    
$q_playercountry small_query("SELECT country FROM uts_ip2country WHERE $playerip BETWEEN ip_from AND ip_to;");
    IF(
$q_playercountry) {
        
$playercountry strtolower($q_playercountry[country]);
        
mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = $playerid") or die(mysql_error());
        
mysql_query("UPDATE uts_player SET country = '$playercountry' WHERE pid = $playerid") or die(mysql_error());
        echo 
"Updated Player ID $playerid to country $playercountry <br />";
    }
}
?>
__________________

Phoenix Alliance - The Movie
Revisionistic Movie
The Unreal Admins Page - the resource for unreal admins

Last edited by Azazel : 25th February, 2007 at 12:03 PM.
Reply With Quote