- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
<?php
function bkconnect($login=FALSE,$update=FALSE){
function get_bk_inf($content){
if (strlen($content) > 0){
preg_match("#align=(.*)#i", $content, $returnarray['align']);
preg_match("#gamecity=(.*)#i", $content, $returnarray['gamecity']);
preg_match("#room_name=(.*)#i", $content, $returnarray['room_name']);
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("#login_online=(.*)#i", $content, $returnarray['login_online']);
foreach($returnarray as $array_name => $array_data){
$returnarray[$array_name] = $returnarray[$array_name][1];
}
}
return $returnarray;
}
function bklogin($login){
$tmp=rawurlencode(trim(strip_tags($login)));
$url="http://sandcity.combats.com/inf.pl?login=".$tmp."&short=1";
$response=get_headers($url,1);
if (strpos($response[0],'302'))
{$url=str_replace(" ","%20",$login);
return file_get_contents($url);}
elseif (strpos($response[0],'200'))
{return file_get_contents($url);}
else {return"";}
return file_get_contents($url);
}
if($update==TRUE){
$myrow = mysql_query("select id,bk_login FROM black_list");
if(mysql_num_rows($myrow)){
while($result = mysql_fetch_array($myrow)){
$contents = bklogin($login);
$info = get_bk_inf($contents);
if(is_array($info)){
$sql="UPDATE `newblacklist` SET
align ='".$info['align']."',
gamecity ='".$info['gamecity']."',
room_name='".$info['room_name']."',
gamecity_url='".$info['gamecity_url']."',
level='".$info['level']."',
klan='".$info['klan']."',
login_online='".$info['login_online']."'
WHERE `id`='".$result['id']."'";
$myrow2 = mysql_query($sql);
}else{echo'error';}
}
}else{return;}
}else{
$contents = bklogin($login);
$info = get_bk_inf($contents);
if(is_array($info)){
return $info;}else{
return 'Чтото не так';}
}
}
function liginviev($inf){
function align($align){if($align>0){return '<img src="http://img.combats.com/i/align'.$align.'.gif" border="0px">';}else{return ' ';}}
function klan($klan){if(strlen($klan)>0){
return "<a href='http://capitalcity.combats.com/clans_inf.pl?".$klan."' target='_blank'>
<img src='http://img.combats.com/i/klan/".$klan.".gif' title='".$klan."'></a>";}else{
return ' ';}}
function room($rooms){if(strlen($rooms)>0){return $rooms;}else{return' ';}}
function online($online){
if($online==1){return'<img src="/i/user_online.gif" />';}else{return'<img src="/i/user_offline.gif" />';}
return $on;}
}
function Logs($id){
$myrow = mysql_query("SELECT * FROM newblacklistlogs WHERE blackId='".$id."'");
$crow['loc'] = mysql_num_rows($myrow);
if($crow['loc']>0){
while($result = mysql_fetch_array($myrow)){
$crow['logs'] .='<a href="'.$result['file'].'" target="_blank"><img src="/i/fighttype6.gif" /></a>';
}
return $crow=array('col'=>$crow['loc'],'logs'=>$crow['logs']);
}else{return $crow=array('col'=>$crow['loc'],'logs'=>' ');}
}
?>