Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('max_execution_time', 800);
- // This file updates: Vocation & Checks for deleted chars / name changes.
- include("../config.php");
- include("../library/tibiaparser.class.php");
- include("../library/mysql.db.class.php");
- // BOF
- global $db;
- $db = new database($db_host, $db_name, $db_user, $db_pass);
- // Updates Tibia Worlds based on Tibia.com
- $tc = new TibiaDotCom();
- // Grab 1000 characters (1000 page requests!)
- $date = date('Y-m-d');
- $db->query("SELECT * FROM characters WHERE character_updated != :date ORDER BY id DESC LIMIT 0,10");
- // Bind
- $db->bind(":date", $date);
- $characters = $db->resultset();
- foreach($characters as $char){
- $character_data = $tc->characterInfo($char["name"]);
- if(!isset($character_data["not_found"])){
- // Gather data
- $vocation = $character_data["vocation"];
- if(isset($character_data["former_names"])){
- $old_names = $character_data["former_names"];
- $old_names = explode(", ", $old_names);
- echo $char["name"];
- print_r($old_names);
- if(count($old_names) > 0){
- // Check if old name is registred, if it is do nothing else save it
- }
- }
- if(isset($character_data["former_world"])){
- $old_world = $character_data["former_world"];
- }
- // Grab world data
- $charid = $char["id"];
- $charworld = $char["world"];
- // Lets explode names and check if there are several older names.
- } else {
- // Uhoh! Character is no longer found, that means it has been deleted!
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement