<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>The script I need to get working should upload 3 data files from a different website and update 3 table in the database with the new information. Then it should compare the registered forum users with the updated tables and return the names of any members who are are no longer in the tribe.

The database is called twfamily_smf1. There are 3 tables I added called tw_player, tw_tribe and  tw_village.  Right now the tables have nothing in them since I can't get the code to run and I also can't seem to import the data in phpmyadmin (it imports the first line and stops). It shows in MySQL Account Maintenance twfamily_update is a user in the twfamily_smf1 and has all privileges. The file is called update.php and is saved in /public_html/Aggression/update.

Can someone tell me what I am not doing right?


[code]
&lt;?php

set_time_limit(600);

$host = &quot;localhost&quot;;
$username = &quot;twfamily_update&quot;;
$password = &quot;XXXXX&quot;;
$database = &quot;twfamily_smf1&quot;;
$prefix = &quot;tw_&quot;;

if (!$mysql_connection = mysql_connect($host, $username, $password))
    die(&quot;Could not connect to MySQL database: &quot;.mysql_error());
else
    echo &quot;Connected successfully!&lt;br /&gt;&quot;;

$village_info = &quot;http://en13.tribalwars.net/map/village.txt.gz&quot;;
$player_info  = &quot;http://en13.tribalwars.net/map/tribe.txt.gz&quot;;
$ally_info    = &quot;http://en13.tribalwars.net/map/ally.txt.gz&quot;;

mysql_query(&quot;USE $database&quot;);

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;player&quot;);
$lines = gzfile($player_info);
if (!is_array($lines))
    die(&quot;Could not open player info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $ally, $villages, $points, $rank) = explode(',', $line);
    $name = prepare($name);
    mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;player VALUES ($id, '$name', $ally, $villages, $points, $rank)&quot;);
}
echo &quot;Inserted player info.&lt;br /&gt;&quot;;

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;ally&quot;);
$lines = gzfile($ally_info);
if (!is_array($lines))
    die(&quot;Could not open ally info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $tag, $members, $villages, $points, $all_points, $rank) = explode(',', $line);
    $name = prepare($name);
    $tag  = prepare($tag);
    mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;ally VALUES ($id, '$name', '$tag', $members, $villages, $points, $all_points, $rank)&quot;);
}
echo &quot;Inserted ally info.&lt;br /&gt;&quot;;

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;village&quot;);
$lines = gzfile($village_info, &quot;r&quot;);
if (!is_array($lines))
    die(&quot;Could not open village info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $x, $y, $player_id, $points, $rank) = explode(',', $line);
    $name = prepare($name);
    if (!mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;village VALUES ($id, '$name', $x, $y, $player_id, $points, $rank)&quot;)) {
            echo mysql_error();
            break;
    }
}
echo &quot;Inserted village info.&lt;br /&gt;&quot;;

$members = mysql_query(&quot;SELECT memberName FROM smf_members&quot;);
while ($member = mysql_fetch_row($members)) {
    mprint_r($member);
    $member_stat = mysql_query(&quot;SELECT ally, name FROM $prefix&quot;.&quot;player WHERE name = '$member[0]'&quot;);
    $member_info = mysql_fetch_row($member_stat);
    if (!$member_info[1]) {
        echo &quot;** &lt;b&gt;$member[0]&lt;/b&gt; is not an Aggression Family Member.&lt;br /&gt;&quot;;
        continue;
    }
    mprint_r($ally_id);
    $ally = mysql_query(&quot;SELECT name FROM $prefix&quot;.&quot;ally WHERE id = '$member_info[0]'&quot;);
    $ally_name = mysql_fetch_row($ally);
    mprint_r($ally_name);
    if (!$ally_name[0]) {
        echo &quot;*&lt;b&gt;$member[0]&lt;/b&gt; is not in any tribe&lt;br /&gt;&quot;;
        continue;
    }
    if (($ally_name[0] != &quot;R@&quot;) &amp;&amp; ($ally_name[0] != &quot;D@&quot;) &amp;&amp; ($ally_name[0] != &quot;R@A&quot;) &amp;&amp; ($ally_name[0] != &quot;D@A&quot;))
        echo &quot;&lt;b&gt;$member[0]&lt;/b&gt; is in $ally_name[0]&lt;br /&gt;&quot;;
}

function prepare($string) {
    return addslashes(urldecode($string));
}

function mprint_r($array) {
    echo &quot;&lt;pre&gt;&quot;;   
    print_r($array);
    echo &quot;&lt;/pre&gt;&quot;;   
}
?&gt;
[/code]</body>
  <body-html>The script I need to get working should upload 3 data files from a different website and update 3 table in the database with the new information. Then it should compare the registered forum users with the updated tables and return the names of any members who are are no longer in the tribe.

The database is called twfamily_smf1. There are 3 tables I added called tw_player, tw_tribe and  tw_village.  Right now the tables have nothing in them since I can't get the code to run and I also can't seem to import the data in phpmyadmin (it imports the first line and stops). It shows in MySQL Account Maintenance twfamily_update is a user in the twfamily_smf1 and has all privileges. The file is called update.php and is saved in /public_html/Aggression/update.

Can someone tell me what I am not doing right?


[code]
&lt;?php set_time_limit(600);

$host = &quot;localhost&quot;;
$username = &quot;twfamily_update&quot;;
$password = &quot;XXXXX&quot;;
$database = &quot;twfamily_smf1&quot;;
$prefix = &quot;tw_&quot;;

if (!$mysql_connection = mysql_connect($host, $username, $password))
    die(&quot;Could not connect to MySQL database: &quot;.mysql_error());
else
    echo &quot;Connected successfully!&lt;br ?&gt;&quot;;

$village_info = &quot;http://en13.tribalwars.net/map/village.txt.gz&quot;;
$player_info  = &quot;http://en13.tribalwars.net/map/tribe.txt.gz&quot;;
$ally_info    = &quot;http://en13.tribalwars.net/map/ally.txt.gz&quot;;

mysql_query(&quot;USE $database&quot;);

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;player&quot;);
$lines = gzfile($player_info);
if (!is_array($lines))
    die(&quot;Could not open player info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $ally, $villages, $points, $rank) = explode(',', $line);
    $name = prepare($name);
    mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;player VALUES ($id, '$name', $ally, $villages, $points, $rank)&quot;);
}
echo &quot;Inserted player info.&lt;br /&gt;&quot;;

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;ally&quot;);
$lines = gzfile($ally_info);
if (!is_array($lines))
    die(&quot;Could not open ally info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $tag, $members, $villages, $points, $all_points, $rank) = explode(',', $line);
    $name = prepare($name);
    $tag  = prepare($tag);
    mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;ally VALUES ($id, '$name', '$tag', $members, $villages, $points, $all_points, $rank)&quot;);
}
echo &quot;Inserted ally info.&lt;br /&gt;&quot;;

mysql_query(&quot;DELETE FROM $prefix&quot;.&quot;village&quot;);
$lines = gzfile($village_info, &quot;r&quot;);
if (!is_array($lines))
    die(&quot;Could not open village info file.&quot;); 
foreach($lines as $line) {
    list ($id, $name, $x, $y, $player_id, $points, $rank) = explode(',', $line);
    $name = prepare($name);
    if (!mysql_query(&quot;INSERT INTO $prefix&quot;.&quot;village VALUES ($id, '$name', $x, $y, $player_id, $points, $rank)&quot;)) {
            echo mysql_error();
            break;
    }
}
echo &quot;Inserted village info.&lt;br /&gt;&quot;;

$members = mysql_query(&quot;SELECT memberName FROM smf_members&quot;);
while ($member = mysql_fetch_row($members)) {
    mprint_r($member);
    $member_stat = mysql_query(&quot;SELECT ally, name FROM $prefix&quot;.&quot;player WHERE name = '$member[0]'&quot;);
    $member_info = mysql_fetch_row($member_stat);
    if (!$member_info[1]) {
        echo &quot;** &lt;b&gt;$member[0]&lt;/b&gt; is not an Aggression Family Member.&lt;br /&gt;&quot;;
        continue;
    }
    mprint_r($ally_id);
    $ally = mysql_query(&quot;SELECT name FROM $prefix&quot;.&quot;ally WHERE id = '$member_info[0]'&quot;);
    $ally_name = mysql_fetch_row($ally);
    mprint_r($ally_name);
    if (!$ally_name[0]) {
        echo &quot;*&lt;b&gt;$member[0]&lt;/b&gt; is not in any tribe&lt;br /&gt;&quot;;
        continue;
    }
    if (($ally_name[0] != &quot;R@&quot;) &amp;&amp; ($ally_name[0] != &quot;D@&quot;) &amp;&amp; ($ally_name[0] != &quot;R@A&quot;) &amp;&amp; ($ally_name[0] != &quot;D@A&quot;))
        echo &quot;&lt;b&gt;$member[0]&lt;/b&gt; is in $ally_name[0]&lt;br /&gt;&quot;;
}

function prepare($string) {
    return addslashes(urldecode($string));
}

function mprint_r($array) {
    echo &quot;&lt;pre&gt;&quot;;   
    print_r($array);
    echo &quot;&lt;/pre&gt;&quot;;   
}
?&gt;
[/code]</body-html>
  <created-at type="datetime">2008-03-24T18:59:22Z</created-at>
  <forumable-id type="integer">1</forumable-id>
  <forumable-type>Forum</forumable-type>
  <id type="integer">7786</id>
  <topic-id type="integer">2015</topic-id>
  <updated-at type="datetime">2008-03-24T18:59:22Z</updated-at>
  <user-agent nil="true"></user-agent>
  <user-id type="integer">48334</user-id>
</post>
