<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><form method="GET" action="/clanlocator.php" style="margin-left: 10px;">
Введите название клана: <input type="text" name="name" value="<?= $_GET['name']?>"/>
<input type="submit" value="Найти" />
</form>
<?
ini_set('max_execution_time', 0);
function getClan($clan) {
$tmp=rawurlencode($clan);
$url="http://oldbk.com/encicl/klani/clans.php?clan=".$tmp;
$response=get_headers($url,1);
if (strpos($response[0],'302'))
{
$url=str_replace(" ","%20",$response['Location']);
$contents = file_get_contents($url);
}
elseif (strpos($response[0],'200'))
{
$contents = file_get_contents($url);
} else {
$contents="";
}
$contents = file_get_contents($url);
return $contents;
}
function get_user_info($content)
{
$returnarray = array();
if (strlen($content) > 0)
{
preg_match("#login=(.*)#i", $content, $returnarray['login']);
preg_match("#id=(.*)#i", $content, $returnarray['id']);
preg_match("#align=(.*)#i", $content, $returnarray['align']);
preg_match("#gamecity=(.*)#i", $content, $returnarray['gamecity']);
preg_match("#gamecity_url=(.*)#i", $content, $returnarray['gamecity_url']);
preg_match("#level=(.*)#i", $content, $returnarray['level']);
preg_match("#klan=(.*)#i", $content, $returnarray['klan']);
preg_match("#bossklan=(.*)#i", $content, $returnarray['bossklan']);
preg_match("#loc=(.*)#i", $content, $returnarray['room_name']);
preg_match("#battle_id=(.*)#i", $content, $returnarray['battle_id']);
preg_match("#status=(.*)#i", $content, $returnarray['rank']);
preg_match("#online=(.*)#i", $content, $returnarray['login_online']);
preg_match("#HP=(.*)#i", $content, $returnarray['HP']);
preg_match("#reputations=(.*)#i", $content, $returnarray['reputations']);
foreach($returnarray as $array_name => $array_data)
{
$returnarray[$array_name] = @$returnarray[$array_name][1];
}
}
return $returnarray;
}
function get_users_list($content) {
if (strlen($content) > 0)
{
preg_match_all('/inf.php?([0-9]+)/i',$content, $return);
}
return $return[1];
}
function parse_users($users_list) {
$ret['offline'] = array();
$ret['online'] = array();
foreach ($users_list as $k => $u) {
$ui = get_info($u);
if ($ui['login_online'] == 1) {
$key = 'online';
} else {
$key = 'offline';
}
$ret[$key][] = $ui;
}
return $ret;
}
function get_info($user) {
#$tmp=rawurlencode($user);
$url="http://capitalcity.oldbk.com/inf.php?".$user."&short=1";
$response=get_headers($url,1);
if (strpos($response[0],'302'))
{
$url=str_replace(" ","%20",$response['Location']);
$contents = file_get_contents($url);
}
elseif (strpos($response[0],'200'))
{
$contents = file_get_contents($url);
} else {
$contents="";
}
$info = get_user_info($contents);
if ($info['bossklan'] == "1")
{
$info['rank'] = "
Глава клана";
}
return $info;
}
function create_name($user) {
#print_r($user);
$u = $user;
$html = '';
if ($u['klan'] != '') {$clan_img = '
';} else { $clan_img = '';}
$align = '
';
if ($u['login_online'] == 1) {
$status = '<b style="color:#F00">Online[/b]
- '.$u['room_name'].'';
} else {
$status = 'Offline';
}
$html .= $align.$clan_img.'
'.$u['login'].' ['.$u['level'].']
Вам необходимо зарегистрироваться для просмотра ссылок
- (rank: '. strip_tags($u['rank']).') - '.$status;
return $html;
}
$name = $_GET['name'];
$clan = getClan($name);
$users_list = get_users_list($clan);
$all_users = parse_users($users_list);
?>
<div style="padding: 15px;">
<?
foreach($all_users['online'] as $user) {
echo create_name($user)."
";
}
foreach($all_users['offline'] as $user) {
echo create_name($user)."
";
}
?>
</div></div>
дальше сами копайте ( может кто до ума доведёт