Топ репутации
Morphy (72)
Новое на форуме
Мини профиль


[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » Web Разработка » Скрипты PHP » Скрипты для сайта mangos, trinitycore
Скрипты для сайта mangos, trinitycore
GameBOADRДата: Воскресенье, 20.05.2012, 17:31 | Сообщение # 1
Группа: Журналист
Сообщений: 83
Награды: 0
Репутация: 0
Замечания: 0%
config.php

Code

  <?      
  <?     
  ###########################Онлайн############################   
  $ip             ="5.84.130.27";           // IP сервера     
  $dbip           ="127.0.0.1";           // IP mysql     
  $dbport         ="3306";                // порт mysql     
  $gameport       ="8085";                // игровой порт     
  $dblogin        ="mangos";               // логин mysql     
  $dbpass         ="mangos";            // пароль mysql     
  $mdb            ="mangos";              // название базы mangos     
  $rdb            ="realmd";              // название базы realmd     
  $cdb            ="characters";          // название базы characters     
  ?>


Подключение к базе
Code

  <?      
  require_once ('config.php');      
  mysql_connect ("$dbip:$dbport","$dblogin","$dbpass");      
  ?>


Проверка статуса сервера.

Code

  <?      
  mysql_selectdb ($rdb);      
  $acc = mysql_query ("select count(*) from account");      
  $acc = mysql_result ($acc,0);      
  mysql_selectdb ("$cdb");      
  $char = mysql_query ("select count(*) from characters");      
  $char = mysql_result ($char,0);      
  $alliance = mysql_query ("select count(*) from characters where race in (1,3,4,7,11)");      
  $alliance = mysql_result ($alliance,0);      
  $horde = mysql_query ("select count(*) from characters where race in (2,5,6,8,10)");      
  $horde = mysql_result ($horde,0);      
  $guild = mysql_query ("select count(*) from guild");      
  $guild = mysql_result ($guild,0);      
  echo "Аккаунтов: $acc<br>";      
  echo "Персонажей: $char<br>";      
  echo "Альянса: $alliance<br>";      
  echo "Орды: $horde<br>";      
  echo "Гильдий: $guild<br>";      
  ?>



Кол-во игроков онлайн, орды онлайн, альянса онлайн, максимальный онлайн.


Code

<?      
  mysql_selectdb ("$cdb");      
  $online = mysql_query ("select count(*) from characters where online = 1");      
  $online = mysql_result ($online,0);      
  $allianceonline = mysql_query ("select count(*) from characters where online = 1 and race in (1,3,4,7,11)");      
  $allianceonline = mysql_result ($allianceonline,0);      
  $hordeonline = mysql_query ("select count(*) from characters where online = 1 and race in (2,5,6,8,10)");      
  $hordeonline = mysql_result ($hordeonline,0);      
  mysql_selectdb ("$rdb");      
  $max = mysql_query ("select max(`maxplayers`) from uptime");            
  $max = mysql_result ($max,0);      
  echo "Игроков Онлайн: $online<br>";      
  echo "Альянса Онлайн: $allianceonline<br>";      
  echo "Орды Онлайн: $hordeonline<br>";      
  echo "Максимальный Онлайн: $max<br>";      
  ?>


Время работы сервера.

Code
<?      
  mysql_select_db ("$rdb");      
  $uptime = mysql_query ("select max(`starttime`) from `uptime`");      
  $uptime = time()-mysql_result ($uptime,0);      
  $sec = $uptime%60;      
  $uptime = intval ($uptime/60);      
  $min = $uptime%60;      
  $uptime = intval ($uptime/60);      
  $hours = $uptime%24;      
  $uptime = intval($uptime/24);           
  $days = $uptime;      
  echo "Время Работы: $days д $hours ч $min м $sec с<br>";      
  ?>


Статистика по расам и классам.
Code

<?      
  mysql_selectdb ("$cdb");      
  $human = mysql_query ("select count(*) from characters where race = 1");      
  $human = mysql_result ($human,0);      
  $dwarv = mysql_query ("select count(*) from characters where race = 3");      
  $dwarv = mysql_result ($dwarv,0);      
  $night = mysql_query ("select count(*) from characters where race = 4");      
  $night = mysql_result ($night,0);      
  $gnome = mysql_query ("select count(*) from characters where race = 7");      
  $gnome = mysql_result ($gnome,0);      
  $draenei = mysql_query ("select count(*) from characters where race = 11");      
  $draenei = mysql_result ($draenei,0);      
  $orc = mysql_query ("select count(*) from characters where race = 2");      
  $orc = mysql_result ($orc,0);      
  $undead = mysql_query ("select count(*) from characters where race = 5");      
  $undead = mysql_result ($undead,0);      
  $tauren = mysql_query ("select count(*) from characters where race = 6");      
  $tauren = mysql_result ($tauren,0);      
  $troll = mysql_query ("select count(*) from characters where race = 8");      
  $troll = mysql_result ($troll,0);      
  $blood = mysql_query ("select count(*) from characters where race = 10");      
  $blood = mysql_result ($blood,0);      
  $druid = mysql_query ("select count(*) from characters where class = 11");      
  $druid = mysql_result ($druid,0);      
  $hunter = mysql_query ("select count(*) from characters where class = 3");      
  $hunter = mysql_result ($hunter,0);      
  $mage = mysql_query ("select count(*) from characters where class = 8");      
  $mage = mysql_result ($mage,0);      
  $paladin = mysql_query ("select count(*) from characters where class = 2");      
  $paladin = mysql_result ($paladin,0);      
  $priest = mysql_query ("select count(*) from characters where class = 5");      
  $priest = mysql_result ($priest,0);      
  $rogue = mysql_query ("select count(*) from characters where class = 4");      
  $rogue = mysql_result ($rogue,0);      
  $shaman = mysql_query ("select count(*) from characters where class = 7");      
  $shaman = mysql_result ($shaman,0);      
  $warlock = mysql_query ("select count(*) from characters where class = 9");      
  $warlock = mysql_result ($warlock,0);      
  $warrior = mysql_query ("select count(*) from characters where class = 1");      
  $warrior = mysql_result ($warrior,0);      
  $death = mysql_query ("select count(*) from characters where class = 6");      
  $death = mysql_result ($death,0);      
  echo "Людей: $human<br>";      
  echo "Дворфов: $dwarv<br>";      
  echo "Ночных Эльфов: $night<br>";      
  echo "Гномов: $gnome<br>";      
  echo "Дренейев: $draenei<br>";      
  echo "Орков: $orc<br>";      
  echo "Нежити: $undead<br>";      
  echo "Тауренов: $tauren<br>";      
  echo "Троллей: $troll<br>";      
  echo "Эльфов Крови: $blood<br><br>";      
  echo "Друидов: $druid<br>";      
  echo "Охотников: $hunter<br>";      
  echo "Магов: $mage<br>";      
  echo "Паладинов: $paladin<br>";      
  echo "Жрецов: $priest<br>";      
  echo "Разбойников: $rogue<br>";      
  echo "Шаманов: $shaman<br>";      
  echo "Чернокнижников: $warlock<br>";      
  echo "Воинов: $warrior<br>";      
  echo "Рыцарей Смерти: $death<br>";      
  ?>


Список игроков онлайн.

Code


  <table border="0">      
  <tr>      
  <td><strong>Имя:</strong></td>      
  <td><strong>Раса:</strong></td>      
  <td><strong>Класс:</strong></td>      
  <td><strong>Уровень:</strong></td>      
  </tr>      
  <?      
  mysql_selectdb ("$cdb");      
  mysql_query ('set names cp1251');      
  $result = mysql_query ("select name, race, class, data from characters where online = 1");      
  $class = array      
  (1=>"Воин",2=>"Паладин",3=>"Охотник",4=>"Разбойник",5=>"Жрец",6=>"Рыцарь Смерти",7=>"Шаман",8=>"Маг",9=>"Чернокнижник",11=>"Друид");      
  $race = array      
  (1=>"Человек",2=>"Орк",3=>"Дворф",4=>"Ночной Эльф",5=>"Нежить",6=>"Таурен",7=>"Гном",8=>"Тролль",10=>"Эльф Крови",11=>"Дреней");      
  while ($row = mysql_fetch_array ($result))      
  {      
  $ch_name = $row['name'];      
  $ch_race = $row['race'];      
  $ch_class = $row['class'];      
  $char_data = explode(' ',$row['data']);      
  $ch_lvl = $char_data[53];      
  echo "<tr><td><strong>$ch_name</strong></td>";      
  echo "<td><strong>$race[$ch_race]</strong></td>";      
  echo "<td><strong>$class[$ch_class]</strong></td>";      
  echo "<td><strong>$ch_lvl</strong></td></tr>";      
  }      
  ?>      
  </table>


скрипт Банов

Code

<?php           
  // Скрипт показа забанненных аккаунтов и IP адресов by WoW-Ultimate      
  require_once "config.php";           

  //подключение к базе      
  $ConnectDB = mysql_connect("$host", "$user", "$password") or die ("Нет соединения с MySQL");           
  mysql_select_db("$dbr") or die ("Нет соединения с базой $dbr");      
  echo "<h2>Забаненные аккаунты</h2>";      
  echo "<table width=\"100%\" border=\"1\" align=\"center\"><tr>      
  <td align=\"center\" width=\"20%\">забанен:</td>      
  <td align=\"center\" width=\"20%\">Бан установлен:</td>      
  <td align=\"center\" width=\"20%\">Забанил:</td>      
  <td align=\"center\" width=\"20%\">Причина:</td>      
  <td align=\"center\" width=\"20%\">Бан до:</td>      
  </tr></table>";      
  $i=0;      
  $data = mysql_query("SELECT * FROM account_banned WHERE active = 1 ORDER BY bandate DESC LIMIT 100",$ConnectDB);      
  $row = mysql_fetch_array($data[$i]); {      
  while($row = mysql_fetch_array($data)) {      
  $banid = $row['id'];      
  $usern = mysql_query("SELECT * FROM account WHERE id= $banid LIMIT 1",$ConnectDB);      
  $rowuser = mysql_fetch_array($usern);      
  $banuser = $rowuser['username'];      
  $bandate = date("H:i:s d.m.Y", $row['bandate']);      
  $bannedby = $row['bannedby'];      
  $banreason = $row['banreason'];      
  $unbandate = date("H:i:s d.m.Y", $row['unbandate']);      
  echo "<font color=\"beer\">      
  <table width=\"100%\" border=\"1\" align=\"center\"><tr>      
  <td align=\"center\" width=\"20%\">$banuser</td>      
  <td align=\"center\" width=\"20%\">$bandate г.</td>      
  <td align=\"center\" width=\"20%\">$bannedby</td>      
  <td align=\"center\" width=\"20%\">$banreason</td>      
  <td align=\"center\" width=\"20%\">$unbandate г.</td>      
  </tr></table></font>";      
  $i++;      
  }      
  }      
  //теперь выборка по IP адресам      
  echo "<h2>БАНЫ по IP </h2><br>";      
  echo "<table width=\"100%\" border=\"1\" align=\"center\"><tr>      
  <td align=\"center\" width=\"20%\">IP:</td>      
  <td align=\"center\" width=\"20%\">Бан установлен:</td>      
  <td align=\"center\" width=\"20%\">Забанил:</td>      
  <td align=\"center\" width=\"20%\">Причина:</td>      
  <td align=\"center\" width=\"20%\">Бан до:</td>      
  </tr></table>";      
  $u=0;      
  $bannedip = mysql_query("SELECT * FROM ip_banned ORDER BY bandate DESC LIMIT 100");      
  $row = mysql_fetch_array($bannedip[$u]); {      
  while($row = mysql_fetch_array($bannedip)) {      

  $banip = $row['ip'];      
  $bandate = date("H:i:s d.m.Y", $row['bandate']);      
  $bannedby = $row['bannedby'];      
  $banreason = $row['banreason'];      
  $unbandate = date("H:i:s d.m.Y", $row['unbandate']);      
  echo "<font color=\"beer\">      
  <table width=\"100%\"border=\"1\" align=\"center\"><tr>      
  <td align=\"center\" width=\"20%\">$banip</td>      
  <td align=\"center\" width=\"20%\">$bandate г.</td>      
  <td align=\"center\" width=\"20%\">$bannedby</td>      
  <td align=\"center\" width=\"20%\">$banreason</td>      
  <td align=\"center\" width=\"20%\">$unbandate г.</td>      
  </tr></table></font>";      
  $u++;      
  }      
  }      
  ?>       


Скрипт чата на сайт

Code
<?   

  /*   
  Tagbox v0.2   

  Author: Erik Boeters <erik@westland.ath.cx>   
  Website: http://westland.ath.cx/   

  SQL query:   

  CREATE TABLE `tagbox` (   
  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,   
  `message` TEXT NOT NULL,   
  INDEX (`ID`),   
  UNIQUE (`ID`)   
  );   

  */   

  // Database related settings.   
  DEFINE("SERVER", "127.0.0.1");   
  DEFINE("DATABASE", "westland.ath.cx");   
  DEFINE("USERNAME", "westland.ath.cx");   
  DEFINE("DBPASSWORD", "");   

  // Tagbox related.   
  DEFINE("SHOWTIME", false); // true or false   
  DEFINE("SHOWMESSAGES", "20");   
  DEFINE("TAGBOXFONTSIZE", "8"); // in pixels   
  DEFINE("TAGBOXWIDTH", "190"); // in pixels   
  DEFINE("TAGBOXHEIGHT", "70"); // in pixels   
  DEFINE("BORDERWIDTH", "1"); // in pixels   
  DEFINE("BORDERCOLOR", "#CCCCCC"); // in HEX   
  DEFINE("BGCOLOR", "#FBFBFB"); // in HEX   

  // Not neccesary to modify.   

  $db = mysql_connect(SERVER, USERNAME, DBPASSWORD);   
  DEFINE("S", $PHP_SELF);   
  $styleprops = array(TAGBOXFONTSIZE,TAGBOXFONTSIZE,TAGBOXWIDTH,TAGBOXHEIGHT,BORDERWIDTH,BORDERCOLOR,BGCOLOR);   

  function showMessages($m,$s,$style) {   
  $queryGetMessages = "SELECT * FROM tagbox order by ID DESC LIMIT 0, $m";   
  $resultGetMessages = mysql_db_query(DATABASE, $queryGetMessages);   
  $queryCountMessages = "SELECT * FROM tagbox";   
  $resultCountMessages = mysql_db_query(DATABASE, $queryCountMessages);   
  $o .=" <form name=\"tagbox\" action=\"$s\" method=\"post\">\n";   
  $o .=" <input type=\"hidden\" name=\"tagboxa\" value=\"sm\" /> <textarea title=\"# of messages: ".mysql_num_rows($resultCountMessages)."\"\n";   
  $o .=" style=\"WIDTH: $style[2]px;background-color : $style[6];HEIGHT: $style[3];border: $style[4]px solid $style[5];font-size: $style[0]pt;\" name=\"messages\"\n";   
  $o .=" readonly=\"readonly\">\n";   
  for($i=0;$row=mysql_fetch_array($resultGetMessages);$i++) {   
  $o .="$row[message]\n";   
  }   
  $o .=" </textarea>
\n";   
  $o .=" <input name=\"newmessage\"\n";   
  $o .=" style=\"WIDTH: $style[2]px;background-color : $style[6];border: $style[4]px solid $style[5];font-size: $style[0]pt;line-height: ".($style[0]+1)."pt;\" />\n";   
  $o .=" </form>\n";   
  $o .=" <script language=\"JavaScript\" type=\"text/javascript\">\n";   
  $o .=" document.tagbox.newmessage.focus()\n";   
  $o .=" </script>\n";   
  return $o;   
  }   

  function sendMessage($m,$SERVER_NAME,$REQUEST_URI) {   
  if (!$m) {   
  return false;   
  }   
  if (SHOWTIME) {   
  $m = date ("G:i").">$m";   
  } else {   
  $m = ">$m";   
  }   
  $m = htmlspecialchars($m);   
  $querySendMessage = "INSERT INTO `tagbox` (`ID`, `message`) VALUES ('', '$m')";   
  $resultSendMessage = mysql_db_query(DATABASE, $querySendMessage);   
  if (!$resultSendMessage) {   
  return false;   
  } else {   
  header("Location: http://".$SERVER_NAME.$REQUEST_URI);   
  }   
  }   

  switch ($tagboxa) {   
  case "sm":   
  print sendMessage($newmessage,$SERVER_NAME,$REQUEST_URI);   
  break;   
  }   

  mysql_close($db);   

  ?>   

  <html>   
  <head>   
  <title>   
  Tagbox example   
  </title>   
  </head>   
  <body>   
  <?print showMessages(SHOWMESSAGES,S,$styleprops);?>   
  </body>   
  </html>


Code

<?   
  ###########################Регистрация############################   
  $db1 = "realmd"; // база реалмов          
  $db2 = "mangos"; // база мира       
  $db3 = "characters"; // база чаров      
  $host = "localhost"; // адрес БД        
  $user = "mangos"; // логин к БД                
  $pass = "mangos"; // пароль к БД                     
  $port = "3306"; // порт к БД       
  #################################################################   
  ?>
Форум » Web Разработка » Скрипты PHP » Скрипты для сайта mangos, trinitycore
  • Страница 1 из 1
  • 1
Поиск:
          




Используются технологии uCoz