[-]
Shout:
Click Refresh to load shouts.

Post Reply 
 
Thread Rating:
  • 1 Votes - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PHP] Updated Character List Script (Request)
08-10-2009, 09:39 PM
Post: #1
[PHP] Updated Character List Script (Request)
Some one got a updated php script for online list please?
Find all posts by this user
Quote this message in a reply
08-11-2009, 12:42 AM
Post: #2
[PHP] Updated Character List Script (Request)
Didn't edit out the unneeded code as Im lazy but if you know any php its easy to see.

Code:
<?
include 'config.php';
include 'opendb.php';

mysql_query ("DELETE FROM `onlinelist`");

$world = "Dolera";
$file = "http://www.tibia.com/community/?subtopic=whoisonline&world=$world";
$text = file_get_contents($file) or die("World Does not exist.");
preg_match_all('/\&name=[^">]*">([^<]+)</i', $text, $matches);
preg_match_all('/<\/TD><TD WIDTH=10\%>(.*)<\/[^>]+>/U', $text, $level);

$count = count($matches[0]);
$script = 1;

if($count > 0) {
    echo "$count players online on $world<br><br>";
    for ($label = 0; $label < $count; $label++ ) {
            
            
            $matches[1][$label] = str_replace("%27","'",$matches[1][$label]);
            $matches[1][$label] = str_replace(" "," ",$matches[1][$label]);
            $matches[1][$label] = addslashes($matches[1][$label]);
            mysql_query("INSERT INTO onlinelist (name,script,level) VALUES ('".$matches[1][$label]."','$script','".$level[1][$label]."')") or die(mysql_error());
            mysql_query("UPDATE `character` SET day0=day0 + 5 WHERE name='".$matches[1][$label]."'") or die(mysql_error());

            
            
            $script++;
            if ($script > 7) {
                $script = 1;
            }
    }
}

else {
    echo "<font color=red>This world does not exist</color>";
}

mysql_query ("DELETE FROM `onlinelist` WHERE name='Nudan'");

include 'closedb.php';
?>
Find all posts by this user
Quote this message in a reply
Post Reply 



Contact UsTProgrammingReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication