http://wowsoft.ru/shapkawowsoft.jpg
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
Страница 1 из 11
Модератор форума: Mannoroh 
Форум » MANGOS » Сайты / WWW для Mangos » Скрипты для сайта (Вот немного)
Скрипты для сайта
KiTДата: Воскресенье, 28.02.2010, 13:44 | Сообщение # 1
Скаут
Группа: Пользователи
Сообщений: 7
Статус: :-)
config.php
Code

<?   
$ip             ="127.0.0.1";           // IP сервера   
$dbip           ="127.0.0.1";           // IP mysql   
$dbport         ="3306";                // порт mysql   
$gameport       ="8085";                // игровой порт   
$dblogin        ="Логин";               // логин mysql   
$dbpass         ="Пароль";            // пароль 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><br />\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>
 
PitonДата: Среда, 10.03.2010, 14:41 | Сообщение # 2
Скаут
Группа: Пользователи
Сообщений: 6
Статус: :-)
Восстановление пароля:

Code
<?php
/*
Very important! You need to run SQL update!
ALTER TABLE `account` ADD `reset_password` VARCHAR( 50 ) NOT NULL;
*/
/*Config*/
$realmd = array(
'db_host'=> 'localhost', //ip of db realm
'db_username' => 'mangos',//realm user
'db_password' => '',//realm password
'db_name'=> 'realmd',//realm db name
);
$config = array(
'path_to_thisfile' => 'http://mysite.com/lol/ownage/wow/pass_recovery.php', // Example: http://mysite.com/lol/ownage/wow/
'email_from' => 'mysite@wow.com', // Who should the email be sent from ?
'email_subject' => 'Password recovery for our site!', // Subject of the mail ??
);

function sha_password($user,$pass){
$user = strtoupper($user);
$pass = strtoupper($pass);

return SHA1($user.':'.$pass);
}
function random_string($counts){
$str = "abcdefghijklmnopqrstuvwxyz";//Count 0-25
for($i=0;$i<$counts;$i++){
if ($o == 1){
$output .= rand(0,9);
$o = 0;
}else{
$o++;
$output .= $str[rand(0,25)];
}

}
return $output;
}

$realmd_bc_new_connect = mysql_connect($realmd[db_host],$realmd[db_username],$realmd[db_password]);
$selectdb = mysql_select_db($realmd[db_name],$realmd_bc_new_connect);

if ($_GET[h] && $_GET[h] != '' && $_GET[h] != '0'){
$output_random_pass = random_string(10);
$query = mysql_query("SELECT username FROM `account` WHERE reset_password='$_GET[h]'");
$res = mysql_fetch_array($query);
if (mysql_num_rows($query) == 1){
echo "Hi $res[username], Your password is: $output_random_pass. Please change your password fast as possible.";
$pass_hash = sha_password($res[username],$output_random_pass);
mysql_query("UPDATE `account` SET sha_pass_hash='$pass_hash' WHERE reset_password='$_GET[h]'");
mysql_query("UPDATE `account` SET reset_password='' WHERE username='$res[username]'");
}else{
echo "Error.";
}

}else{
?>

<?php
//this is where user fill in and send by email
if ($_POST[password_takeback]){
$check_security = mysql_query("SELECT id FROM `account` WHERE username='$_POST[username]' AND email='$_POST[email]'");
if (isset($_POST['username']) && isset($_POST['email']) && mysql_num_rows($check_security) == 1){
  $rand = random_string(40);
mysql_query("UPDATE `account` SET reset_password='$rand' WHERE username='$_POST[username]'");
$to = $_POST["email"];
$from = "From: $config[email_from]";
$subject = $config[email_subject];
$message= "Hi $_POST[username], you have submitted a password recovery on our site. IF YOU DIDNT SUBMIT A PASSWORD REQUEST JUST DELETE THIS MAIL!. Please follow this link to complete the operation: $config[path_to_thisfile]?h=$rand";
mail($to, $subject, $message, $from); // This work if you have configured your php.ini file to send email, !on linux its default.
echo "An Email has been sent to you, please follow the email to complete the process.";
}else{
echo "Incorrect details, Please be sure that you submitted right Email and Username to your account";
}
}else{
?>
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
Your Email: <input type="text" name="email">

Your Username: <input type="text" name="username">

<input type="submit" name="password_takeback">
</form>
<?php
}
}// End GET
?>

Максимальный онлайн:

Code
<?  
include('config.php');   
mysql_selectdb ("$dbr");  
$max = mysql_query ("select max(`maxplayers`) from uptime");      
$max = mysql_result ($max,0);  
echo "Максимальный онлайн:$max <br>";  
?>

Регистрация:

Code
<?php        

$config = array (  

        // Names of DBs  
        'wname'   => 'mangos', // база мира  
        'rname'   => 'realmd', // база реалмов  
        'cname'   => 'characters', // база чаров  
        // DB settings  
        'host' => '127.0.0.1', // адрес БД  
        'user' => 'mangos', // логин к БД  
        'pass' => 'mangos', // пароль к БД  
        'port' => '3306', // порт к БД  
);  

$db1 = "realmd";                     
$db2 = "mangos";                
$db3 = "characters";            

$host = "localhost";           
$user = "mangos";                   
$pass = "mangos";                      
$port = "3306";                    

$tbc = 2;                        
$database_encoding = 'CP1251';          

$realmd = mysql_connect("$host:$port", "$user", "$pass", True);        
mysql_selectdb("$db1", $realmd);        

$world = mysql_connect("$host:$port", "$user", "$pass", True);        
mysql_selectdb("$db2", $world);        

$characters = mysql_connect("$host:$port", "$user", "$pass", True);        
mysql_selectdb("$db3", $characters);        

echo "        
<script type=\"text/javascript\">        
function isAlphaNumeric(value)        
{        
         if (value.match(/^[a-zA-Z0-9_]+$/))        
           return true;        
         return false;        
}        
function checkform(f)        
{        
         if (f.account.value == \"\")        
         {        
           alert(\"Введите логин\");        
           return false;        
         }        
         if (!isAlphaNumeric(f.account.value))        
         {        
           alert(\"Запрещенные символы в логине\");        
           return false;        
         }        
         if (f.password.value==\"\")        
         {        
           alert(\"Введите пароль\");        
           return false;        
         }        
         if (!isAlphaNumeric(f.password.value))        
         {        
           alert(\"Запрещенные символы в пароле\");        
           return false;        
         }        
         if (f.password2.value==\"\")        
         {        
           alert(\"Вы не ввели повтор пароля\");        
           return false;        
         }        
         if (f.password.value != f.password2.value)        
         {        
           alert(\"Пароли не совпадают\");        
           return false;        
         }        
         if (f.email.value==\"\")        
         {        
           alert(\"Вы не ввели e-mail\");        
           return false;        

         }        
}        
</script>";        

echo "        

<font color=#00CC00>        
</font><br><br>        
<center>        
<form method=post action=register.php onsubmit=\"return checkform(this)\">         
<table>        

<tr>        
         <td>Login: <Br>        
         <input type=text name=account maxlength=20></td>        
</tr>        

<tr>        
         <td> Password:<Br>        
         <input type=password name=password maxlength=20></td>        
</tr>        
<tr>        
         <td> Confirm Password: <Br>        
         <input type=password name=password2 maxlength=20></td>        
</tr>        
<tr>        
         <td> e-mail:<Br>         
         <input type=text name=email maxlength=32></td>        
</tr>        
        <tr>        
         <td colspan=2 style=\"text-align: center;\"><br><input type=submit value=Зарегистрироваться></td>        
        </tr>        
</table>        
</form></center>";        

if (isset($_POST['account'])) {        
if ($_POST['account'] && strlen($_POST['account'])<=20 && strlen($_POST['account'])>=3 && strlen($_POST['password'])>=3 && $_POST['password'] && $_POST['password2'] && $_POST['password']==$_POST['password2']) {        
         if (!eregi("^[a-zA-Z0-9_]+$", $_POST['account']))        
           die ("<p>Error: SQL-Injection</p>");        
         if (!eregi("^[a-zA-Z0-9_]+$", $_POST['password']))        
           die ("<p>Error: SQL-Injection</p>");        
           $pass = ($_POST['password']);        
           $username = ($_POST['account']);        
           $result = mysql_query("SELECT * FROM account WHERE username='".$_POST['account']."' AND sha_pass_hash='$pass'", $realmd);        
           if (mysql_num_rows($result) != 0) {        
               echo "<center><p><font color=#CC0000><b>Такой аккаунт уже есть!</b></font></p></center>";        
           } else {        
               if (!mysql_query("INSERT INTO account (username, sha_pass_hash, gmlevel, email, expansion) VALUES ('$username', SHA1(CONCAT(UPPER('$username'),':',UPPER('$pass'))), 0, '".$_POST['email']."', $tbc)", $realmd)) {echo "<center><p><font color=#CC0000><b>Ошибка</b></font></p></center>";} else {echo "<center><p><font color=#00CC00><b>Аккаунт успешно зарегестрирован! </b></font></p></center>";}        
           }        
} else {        
           echo "<center><p><font color=#CC0000><b>Проверьте правильность ввода!</b></font></p></center>";        
}        
}        

?>

Сменя пароля:
Конфиг:

Code
<?
$host="localhost"; // хост базы REALM
$user="root" ; // пользователь базы REALM
$pass=""; // пароль базы REALM
$db="realmd"; // название базы REALM
?>

Скрипт:

Code
<?php
require_once "config.php";    
        
      $err = Array();
        
      mysql_connect($host.':'.$port, $user, $pass) or die('Нет конекта к MySQL серверу');
      mysql_select_db($db) or die('Выбрана неверная база данных');

      if($_POST['ok'])
      {
          if(!ereg("^[a-zA-Z0-9]+$", $_POST["login"]))
          {
              $err[] = '<b>Имя аккуанта:</b> введены запрещенные символы или поле пустое.';
          }
          if(empty($_POST["oldpass"]))
          {
              $err[] = '<b>Старый пароль:</b> поле пустое.';
          }
          if(empty($_POST["newpass"]))
          {
              $err[] = '<b>Новый пароль:</b> поле пустое.';
          }
          if(empty($_POST["newspasss"]))
          {
              $err[] = '<b>Новый пароль ещё:</b> поле пустое.';
          }
          $login = $_POST["login"];
          $pass = $_POST["oldpass"];
          $newpass = $_POST["newpass"];
          $newpasss = $_POST["newspasss"];
          $hashpass = sha1(strtoupper($login).":".strtoupper($pass));
          $query = mysql_query("SELECT `username`,`sha_pass_hash` FROM `account` WHERE `username`='".$login."'");
          $arr = mysql_fetch_array($query);
          if($arr['username'] != $login){
              $err[] = 'Введён неверный логин';
          }
          if($hashpass != $arr['sha_pass_hash']){     
              $err[] = 'Введён невеный старый пароль';
          }
          if($newpass != $newpasss){     
              $err[] = 'Введённые пароли не совподают';
          }
          if(count($err) == 0){
              mysql_query("UPDATE `account` set sha_pass_hash = SHA1(CONCAT(UPPER('$login'),':',UPPER('$newpass'))) where username = \"".$login."\";");
          }else{
              $err[] = $error;
          }
      }
          foreach ($err as $error){
              echo '<div align="center">'.$error."</div>";
          }
            
          if( $_GET["change"] == null ){
              echo '<form method="POST" enctype="multipart/form-data">
                 <center> <table align="center" border="0" width="" cellpadding="0" cellspacing="0">
                         <tr><td>Имя аккуанта:</td></tr>
                         <tr><td align="center"><input type="text" name="login" align="center"></td></tr>
                         <tr><td>Старый пароль:</td></tr>
                         <tr><td align="center"><input type="password" name="oldpass" align="center"></td></tr>
                         <tr><td>Новый пароль:</td></tr>
                         <tr><td align="center"><input type="password" name="newpass" align="center"></td></tr>
                         <tr><td>Новый пароль ещё:</td></tr>
                         <tr><td align="center"><input type="password" name="newspasss" align="center"></td></tr>
                         <tr><td align="center"><input type="submit" name="ok" value="Сменить пароль"></td></tr></center>
                     </table>        
                 </form>';
          else
              echo "<meta http-equiv=\"refresh\" content=\"5; url=test.php\" />";
              echo '<div align="center" style="color: green; font-weight: bold;" >Пароль сменён успешно !</div>';
          }
?>

Статус сервера:

Code
<?  
include('config.php');  
$fp1 = @fsockopen('$ip', $gameport, $errno, $errstr, 1); // Эти переменные должны присутствовать в конфиге!
$onoff200=($fp1?"Включен":"Выключен");            
          ?>  
<b>Статус сервера:</b><br />  
<? echo " $onoff200"; ?><br /></p>

Добавлено (10.03.2010, 14:38)
---------------------------------------------
Топ арены 5-10:

Code
<?
include ("config.php");

$j=1;
         $teamType = array(
                 '2' => '2x2',
                 '3' => '3x3',
                 '5' => '5x5'
     );
      
$connect = mysql_connect($host,$user,$pass) OR DIE("'Can't connect with $host"); // Эти переменные должны присутствовать в конфиге!  
mysql_select_db($mangoscharacters,$connect) or die(mysql_error());  
mysql_query("SET NAMES '$cod'");  

if(!isset($_GET['guid'])){

$sql = mysql_query("SELECT * FROM `arena_team` ORDER by `name`");

echo "<center><table border=1 width=70%>
<tr>
<td>Team Name</td>
<td align=center>Command Type</td>
<td align=center><center>Team Leader</center></td>
<td>Faction</td>
<td align=center>Rating</td>

</tr>";
while ($row = mysql_fetch_array($sql)){
$query_num = mysql_query("SELECT COUNT(*) FROM `arena_team_member` WHERE `arenateamid`='$row[arenateamid]'");
$gleader = "SELECT name,race FROM `characters` WHERE `guid`='$row[captainguid]'";
$myrow = mysql_fetch_array(mysql_query($gleader));
$top = mysql_query("SELECT * FROM `arena_team_stats` WHERE `arenateamid`='$row[arenateamid]'");
$toprow = mysql_fetch_array($top);

if($myrow['race']=="1" or $myrow['race']=="3" or $myrow['race']=="4" or $myrow['race']=="7" or  $myrow['race']=="11"){
   
  $faction = "alliance";
  }else{
  $faction = "horde";}

echo "
<tr>
<td >
<p style='padding-left: 5px'><a href='?guid=".$row[arenateamid]."' >".$row['name']."</a></p>
</td>
<td  align=center><center>".$teamType[$row['type']]."</center></td>

<td><a href=".$wowd."/index.php?player=".$row[captainguid].">".$myrow['name']."</a></td>
<td align=center><center><img src=images/".$faction.".gif title=".$faction."></center></td>
<td align=right><p style='padding-right: 8px'>".$toprow['rating']."</p></td></tr>";

}
echo "</table></center><br><br>";
}

if (@$_GET['guid'] ) {  

$name = "SELECT * FROM `arena_team` WHERE `arenateamid`='$_GET[guid]'";
$nrow = mysql_fetch_array(mysql_query($name));
$top = "SELECT * FROM `arena_team_stats` WHERE `arenateamid`='$_GET[guid]'";
$trow = mysql_fetch_array(mysql_query($top));
$member = "SELECT * FROM `arena_team_member` WHERE `arenateamid`='$_GET[guid]'";
$mrow = mysql_fetch_array(mysql_query($member));

$sql = mysql_query("SELECT * FROM `characters`, `arena_team_member` WHERE `characters`.`guid`=`arena_team_member`.`guid` and `arenateamid` = '".$_GET["guid"]."' ");
$row = mysql_fetch_array($sql);
$data = explode(' ',$row['data']);
$lvl = $data[$ver];  
$gender = dechex($data[36]);
$gender = str_pad($gender,8, 0, STR_PAD_LEFT);
$gender = $gender{3};
$guid = $row['guid'];
$race = $row['race'];
$class = $row['class'];
$online = $row['online'];
$j=1;

echo "<center>
<table border=0 width=60%>
<tr>
<td>
<table border=1 width=100%>
<tr><td>Team Name</td><td  >".$nrow['name']."</td></tr>
<tr><td>Rating</td><td  >".$trow['rating']."</td></tr>
<tr><td>Command Type</td><td  >".$teamType[$nrow['type']]."</td></tr>
<tr><td colspan=2 >Statistics of the Week</td></tr>
<tr><td>Played: ".$trow['games']."</td><td  >Won: ".$trow['wins']."</td></tr>
<tr><td colspan=2 >Stats</td></tr>
<tr><td>Played: ".$trow['played']."</td><td  >Won: ".$trow['wins2']."</td></tr>

</table>
";

echo "<table border=1 width=100%>
<tr>
<td align=center>#</td>
<td align=center>Player Name</td>
<td align=center>lvl</td>
<td align=center>Race</td>
<td align=center>Class</td>
<td align=center>Game of the Week</td>
<td align=center>Won week</td>
<td align=center>Games for the season</td>
<td align=center>Won season</td>
<td align=center>Personal rating</td>
<td align=center>Online</td>
</tr>
";

echo "<tr>
<td valign=center width=3%>$j</td>
<td align=center valign=center width=20%><a href='/wow/wowd/?player=".$guid."' style='color: #ff9900; font-family : Geneva; text-decoration : none;'>".$row[name]."</a></td>
<td width=20 align=center valign=center>$lvl</td>
<td align=center valign=center width=7%><img src=images/race/".$race."-".$gender.".gif></td>
<td align=center valign=center width=7%><img src=images/class/$class.gif></td>
<td align=center width=20%>".$mrow['played_week']."</td>
<td valign=center width=20%>".$mrow['wons_week']."</td>
<td valign=center width=10%>".$mrow['played_season']."</td>
<td valign=center width=10%>".$mrow['wons_season']."</td>
<td valign=center width=10%>".$mrow['personal_rating']."</td>
<td valign=center width=10%><center><img src='images/status/".$online.".gif' height='18' width='18'></center></td>
</tr>
";

echo "</table></td></tr></table></center><br><br><br>";

echo "<table border=1><tr><td><a href='index.php'>Index</a></td></tr></table>";
}  

?>

Гм'ы он-лайн:

Скрипт:

Code
<html>
<body>
                      <table border = "1" align = "center">
                             <tr>
                             <td>Ник</td>
                             <td>Расса</td>
                    <td>Класс</td>
                             <td>Уровень доступа</td>
                             </tr>                     
<?php

                          /**
                            * @author [Desperado]
                            * @copyright 2010
                           */

                             require_once ('includes/config.php'); //подключаем файл конфигурации

                      mysql_connect("$host", "$db_user", "$db_user_passw"); //соединяемся с базой MySQl
                      mysql_query("SET character_set_database = '$charset'");  //устанавливаем кодировку
                      mysql_query("SET NAMES '$charset'");  //устанавливаем кодировку
                            
                        $content = mysql_query ("select c.name, c.class, c.race, a.gmlevel from characters.characters c inner join realmd.account
                        a on a.id=c.account where a.gmlevel != 0 and c.online = 1");      //достаём нужные данные
                        $online = mysql_num_rows($content);
                    
                    /**
                         * мутим обработку данных из массива
                         */                
                      
                             $class = array(1=>"Воин",2=>"Паладин",3=>"Охотник",4=>"Разбойник",5=>"Жрец",
                         6=>"Рыцарь Смерти",7=>"Шаман",8=>"Маг",9=>"Чернокнижник",11=>"Друид");                           
                             $race = array(1=>"Человек",2=>"Орк",3=>"Дворф",4=>"Ночной Эльф",5=>"Нежить",6=>"Таурен",7=>"Гном",8=>"Тролль",
                         10=>"Эльф Крови",11=>"Дреней");
                             $gmlevel = array(1=>'Модератор',2=>'Хелпер',3=>'Гейм Мастер',4=>'Администратор');
                            
                    /**
                         * если гм нет, выводим неприличное сообщение
                         */                            
                        
                    if($online < 1) {
                    echo "<tr><td colspan='4' align='center'>Нет гм, вошедших в игру</td></tr>";
                    }                            
                          
                            /**
                         * если гм есть, выводим другое неприличное сообщение
                         */                           
                          
                          
                           while ($row = mysql_fetch_array($content))                           
                    {
                      $name = $row['name'];
                          echo "<tr><td><b>{$name}</b></td>";  //выводим ник Гм
                          echo "<td><b>{$race[$row['race']]}</b></td>";  //Выводим рассу
                          echo "<td><b>{$class[$row['class']]}</b></td>"; //Выводим класс
                          echo "<td><b>{$gmlevel[$row['gmlevel']]}</b></td></tr>"; //Выводим уровень доступа
                     }                           

?>
</table>
</body>                             
</html>

Конфиг:

Code
<?php

                           /**
                           * @author [Desperado]
                           * @copyright 2010
                           */

                       $host = "localhost";  //хост сервера MySqL
                       $db_user = "root"; //имя пользователя MySqL
                       $db_user_passw = ""; //пароль MySqL
                       $charset = "utf8"; //устанавливаем кодировку
                       $mmotop = "";     //ссылка до файла MMOTOP
                       $ip= "";          //ip сервера
                       $gameport = "";  //игровой порт

?>

Добавлено (10.03.2010, 14:41)
---------------------------------------------
Будим все вместе пополнять эту тему wink Конфиги писать не стал т.к они ко всем скриптам разные но я подписал у скриптов какие переменные должны быть в конфиге можете их меня на свои.

Все конфиги были нагло скамунижены либо выдернуты у других людей biggrin


SS
 
Jenay199Дата: Воскресенье, 22.08.2010, 15:21 | Сообщение # 3
Чемпион
Группа: Пользователи
Сообщений: 195
Статус: :-)
КУЛ СПС biggrin


не забываем про +ки если помог!
 
Strel[cs]kДата: Воскресенье, 22.08.2010, 20:23 | Сообщение # 4
Лучший из лучших
Группа: Модераторы
Сообщений: 1604
Статус: :-)
темка очень хорошая


 
Jenay199Дата: Воскресенье, 22.08.2010, 21:18 | Сообщение # 5
Чемпион
Группа: Пользователи
Сообщений: 195
Статус: :-)
Ты обсолютно Прав! smile


не забываем про +ки если помог!
 
Форум » MANGOS » Сайты / WWW для Mangos » Скрипты для сайта (Вот немного)
Страница 1 из 11
Поиск:



Copyright WoWsoft © 2010 | Карта сайта | Карта форума Хостинг от uCoz
При использовании материалов необходимо наличие прямой индексируемой ссылки на первоисточник
WoWsoft — World of Warcraft портал — Статьи World of Warcraft | Аддоны для WoW | Патчи World of Warcraft | Cервера WoW | Новости WoW