Сергей Карпов
Участник
- Сообщения
- 2
- Реакции
- 0
Для понимания как здесь http://otstrel.ru/amxbans/ban_list.php
Для понимания как здесь http://otstrel.ru/amxbans/ban_list.php
$serverbanstitle='<h2>Черный список нарушителей</h2>
';
echo $serverbanstitle;
if($_GET['action']=="reason"){
$bid = $_GET['bid'];
$result=safe_query("SELECT * FROM sb_bans WHERE bid='$bid'");
/*$ds=mysql_fetch_array($result);*/
$i = 0;
while ($ds = mysql_fetch_array($result))
{
if(empty($ds['bid'])){ echo'No Person matching this ID'.$bid.' present'; } else {
$ip=$ds['ip'];
$authid=$ds['authid'];
$name=$ds['name'];
$name = ($name == NULL) ? '<b><font color="#CC0000"><STRIKE>Не определен</STRIKE></font></b>' : $ds['name'];
$created=$ds['created'];
//$time = date("Y.m.d H", strtotime($created));
$time = date('Y-m-d H:i:s', (time($created)));
$ends=$ds['ends'];
if ($ends == $created) {
$end = '<b><font color="#CC0000">Бессрочно</font></b>';
} else {
$end = date("Y-m-d H:i", $ds['ends']);
}
$length=$ds['length'];
$reason=$ds['reason'];
$aid=$ds['aid'];
$adminIp=$ds['adminIp'];
$sid=$ds['sid'];
$country=$ds['country'];
$RemovedBy=$ds['RemovedBy'];
$RemoveType=$ds['RemoveType'];
$RemovedOn=$ds['RemovedOn'];
$type=$ds['type'];
$ureason=$ds['ureason'];
$sql = "SELECT * FROM ".PREFIX."user WHERE ip = '".$adminIp."'";
$res = mysql_query($sql) or die (mysql_error());
for ($i = 0; $i < mysql_num_rows($res); $i++){
$row = mysql_fetch_array($res);
}
$username = $row['username'];
$userID = $row['userID'];
$user = "<a href='index.php?site=profile&id=".$userID."'>".$username."</a>";
$IP = $row['ip'];
$steamurl=steam_community::get_steam_url($authid);
$SteamUrl = "<a href='".$steamurl."'>".$authid."</a>";
if ($adminIP==FALSE or NULL) {
$adminIP = "";
} elseif ($adminIP==TRUE) {
$adminIP = $row['ip'];
}
if ($adminIP==FALSE or NULL) {
$adminIP = "";
} elseif ($adminIP==TRUE) {
$adminIP = $row['ip'];
}
$userID = $row['userID'];
$username = $row['username'];
unset($row);
$backlink='<a href="index.php?site=bans" target="_self">Вернуться к списку</a>';
Если сообщение мне адресовано то да сам, только не amxban а sourceban))Я так понял ты сам написал скрипт для работы с БД amxbans???
criminalist,
ты выложил код странички, которую можно интегрировать в сайт, но у меня вопрос, как она инклюдит надписи из сорсбанс? куда ее закинуть или что нужно прописать?
<script type="text/javascript" src="js/script.js"></script>
<?
include('steamclass.php');
/*
Измените настройки подключения к базе данных Sourceban вашего сервера!
*/
DEFINE('SB_DB', 'sourceban'); //Database for sourceban
DEFINE('SB_DB_USER', 'sourceban'); //User for sourceban-database
DEFINE('SB_DB_PASS', 'sourceban'); //Password for sourceban-database
DEFINE('SB_PREFIX', 'sb_'); // Sourceban-Table PREFIX
DEFINE('MAX_ENTRYS', "5"); // Колличество банов в колонке
DEFINE('SOURCEBAN_URL', 'index.php?site=bans'); //Url на вашу страницу sourceban
?>
<?
//Connect to sourceban-db
if($db != SB_DB){
mysql_connect($host, SB_DB_USER, SB_DB_PASS) OR system_error('ERROR: Can not connect to MySQL-Server');
mysql_select_db(SB_DB) OR die("Ошибка: не удалось подключиться к базе данных");
}
$SQL = safe_query("SELECT * FROM ".SB_PREFIX."bans ORDER BY bid DESC LIMIT ".MAX_ENTRYS."");
$error = mysql_error();
if($SQL){
while($row=mysql_fetch_array($SQL)){
$createdate = date("d.m.Y, H:i",$row[created]);
$authid = $row[authid];
$steamurl=steam_community::get_steam_url($authid);
$name = ($row[name] == NULL) ? '<b><font color="#CC0000"><STRIKE>Не определен</STRIKE></font></b>' : $row['name'];
echo'
<div style="line-height:12px;" onmouseover="this.className=\'headline_over\'" onmouseout="this.className=\'headline\'" onclick="window.location=\'index.php?site=bans&action=reason&bid='.$row['bid'].'\'">
<div style="float:left">'.$createdate.'<br/><a href='.$steamurl.'>'.$authid.'</a>
<a href="index.php?site=bans&action=reason&bid='.$row['bid'].'" target="_blank" onmouseover="tooltip.show(\'<b>'.$row['name'].'</b><br /> '.$authid.'</b><br />Причина: '.$row[reason].'\', 200);" onmouseout="tooltip.hide();">'.$name.'</a><br />
</div>
</div>';
}
}else{
echo"Fehler: $error";
}
$sql2 = safe_query("SELECT * FROM ".SB_PREFIX."bans");
$data = mysql_fetch_array($sql2);
$datum = date("d.m.Y",mktime());
$sql3 = safe_query("SELECT created FROM ".SB_PREFIX."bans");
$i=0;
while($today = mysql_fetch_array($sql3)){
$createdate = date("d.m.Y",$today[created]);
if($datum == $createdate){
$i++;
}
}
?>
<?php
class steam_community
{
/*
* Контейнер с информацией на профиль
*/
//public $data = array();
/*
* Контейнер Ошибок
*/
//public $error = array();
/*
* XML строка
*/
private $xml_str = '';
private $xml = '';
/*
* Конструктор Вашего xml профиля =)
*/
public function __construct($steam_url)
{
// Проверяем правильный ли url вы вбили
if(!preg_match("#^http://steamcommunity.com/(id|profiles)/[a-z0-9]{3,255}/{0,1}#i", $steam_url))
{
$this->error[] = 'Invalid Steam URL';
}
// Проверка на наличие ошибок
if(sizeof($this->error))
return;
// Грузим строки xml
$this->load_xml($steam_url);
// Работа над ошибками
if(sizeof($this->error))
return;
// Грузим строки xml
$this->parse_xml();
// Работа над ошибками
if(sizeof($this->error))
return;
// засовываем информацию в массив
$this->map_data();
return;
}
/*
* грузим XML
*/
private function load_xml($steam_url)
{
//Запрашиваем сам xml
$this->xml_str = file_get_contents($steam_url . '?xml=1');
// Ошибки
if(!strpos($http_response_header[0], '200 OK'))
{
$this->error[] = 'Steam Profile request failed';
}
return;
}
/*
* Парсим XML
*/
private function parse_xml()
{
// Get our SimpelXML handle
try
{
$this->xml = @new SimpleXMLElement($this->xml_str);
}
catch (Exception $e)
{
$this->error[] = 'Steam failed, the XML was bad';
}
if($this->xml->error)
{
$this->error[] = 'User does not exist';
}
return;
}
/*
* Суем data в $this->data
*/
private function map_data()
{
$this->data = array(
'steam_id' => self::get_steam_id((string) $this->xml->steamID64),
'steam_name' => (string) $this->xml->steamID,
'steam_avatar_icon' => (string) $this->xml->avatarIcon,
'steam_avatar_medium' => (string) $this->xml->avatarMedium,
'steam_avatar_full' => (string) $this->xml->avatarFull,
'steam_headline' => (string) $this->xml->headline,
'steam_location' => (string) $this->xml->location,
'steam_realname' => (string) $this->xml->realname,
'steam_summary' => (string) $this->xml->summary,
);
return;
}
/*
* Получаем STEAM_0:1:234567 из Community ID (типа 76561198009355146)
*/
/*Получаем Steam от Ссылки на профайл типа (http://steamcommunity.com/profiles/76561198009355146/)*/
public static function get_steam_from_url($steam_url)
{
$id = strtolower($steam_url);
if(strpos($id, 'steam_')) {
echo 'Converted Steam ID: <a href="http://steamcommunity.com/profiles/7656'.(((substr($id, 10)) * 2) + 1197960265728 + (substr($id, 8, 1))).'">7656'.(((substr($id, 10)) * 2) + 1197960265728 + (substr($id, 8, 1))).'</a>';
}else if(strpos($id, 'steamcommunity.com/profiles/')) {
echo "STEAM_0:".(((substr($id, 39, 13)) - 1197960265728) % 2).":".(round(((substr($id, 39, 13)) - 1197960265728) / 2) - ((substr($id, 39, 13)) - 1197960265728) % 2);
}else if(strpos($id, '656119')) {
echo "STEAM_0:".(((substr($id, 4)) - 1197960265728) % 2).":".(round(((substr($id, 4)) - 1197960265728) / 2) - ((substr($id, 4)) - 1197960265728) % 2);
}else if(strpos($id, 'steamcommunity.com/id/')) {
$customid = file($id."?xml=1");
echo "STEAM_0:".(((substr($customid[1], -27, 13)) - 1197960265728) % 2).":".(round(((substr($customid[1], -27, 13)) - 1197960265728) / 2) - ((substr($customid[1], -27, 13)) - 1197960265728) % 2);
}
}
public static function get_steam_id($community_id)
{
$type = (int) (((int) substr((string) $community_id, -1)) & 1) ? 1 : 0;
return sprintf("STEAM_0:%d:%d", $type, ((int) bcsub($community_id, "76561197960265728") - $type) / 2);
}
/*
* Функция получения урлы вашего профайла из STEAM_0:1:234567
*/
public static function get_steam_url($steam_id)
{
$part = explode(':', $steam_id);
return 'http://steamcommunity.com/profiles/' . bcadd(bcadd((string) ((int)$part[2] * 2), '76561197960265728'), $part[1], 0) . '/';
}
}
echo $id;
?>
var tooltip=function(){
var id = 'tt';
var top = 3;
var left = 3;
var maxw = 300;
var speed = 10;
var timer = 20;
var endalpha = 95;
var alpha = 0;
var tt,t,c,b,h;
var ie = document.all ? true : false;
return{
show:function(v,w){
if(tt == null){
tt = document.createElement('div');
tt.setAttribute('id',id);
t = document.createElement('div');
t.setAttribute('id',id + 'top');
c = document.createElement('div');
c.setAttribute('id',id + 'cont');
b = document.createElement('div');
b.setAttribute('id',id + 'bot');
tt.appendChild(t);
tt.appendChild(c);
tt.appendChild(b);
document.body.appendChild(tt);
tt.style.zIndex = '10000';
tt.style.opacity = 0;
tt.style.filter = 'alpha(opacity=0)';
document.onmousemove = this.pos;
}
tt.style.display = 'block';
c.innerHTML = v;
tt.style.width = w ? w + 'px' : 'auto';
if(!w && ie){
t.style.display = 'none';
b.style.display = 'none';
tt.style.width = tt.offsetWidth;
t.style.display = 'block';
b.style.display = 'block';
}
if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
h = parseInt(tt.offsetHeight) + top;
clearInterval(tt.timer);
tt.timer = setInterval(function(){tooltip.fade(1)},timer);
},
pos:function(e){
var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
tt.style.top = (u - h) + 'px';
tt.style.left = (l + left) + 'px';
},
fade:function(d){
var a = alpha;
if((a != endalpha && d == 1) || (a != 0 && d == -1)){
var i = speed;
if(endalpha - a < speed && d == 1){
i = endalpha - a;
}else if(alpha < speed && d == -1){
i = a;
}
alpha = a + (i * d);
tt.style.opacity = alpha * .01;
tt.style.filter = 'alpha(opacity=' + alpha + ')';
}else{
clearInterval(tt.timer);
if(d == -1){tt.style.display = 'none'}
}
},
hide:function(){
clearInterval(tt.timer);
tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
}
};
}();
<?php include('название скрипта.php'); ?>
я имел в виду таблицы, извиняюсь)))Простите но это часть кода а не весь, и простите что за надписи ?)
ок, благодарюесли что спрашивайте )
criminalist, о спасибо!
А можешь пошагово расписать какие файлы куда вставлять? как меня ламера?
<?php include('название скрипта.php'); ?>
include('название скрипта.php');
script.js
steamclass.php