|
Last change
on this file was 410, checked in by george, 17 years ago |
- Opraveno: Povolování registrací. * Upraveno: Přehozeno pořadí vkládání logů mangosu do databáze. Největší naposled, nemusí se provést díky velikosti a chybě.
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 | include('../global.php');
|
|---|
| 3 |
|
|---|
| 4 | $Database->select_db($Config['Mangos']['DatabaseRealmd']);
|
|---|
| 5 | $DbResult = $Database->query('SELECT COUNT(*) FROM account');
|
|---|
| 6 | $Row = $DbResult->fetch_array();
|
|---|
| 7 | $AccountCount = $Row[0];
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 | $Database2 = new Database($Config['CheckRegistration']['Host'], $Config['CheckRegistration']['User'], $Config['CheckRegistration']['Password'], $Config['CheckRegistration']['Database']);
|
|---|
| 11 | $Database2->charset($Config['CheckRegistration']['Charset']);
|
|---|
| 12 |
|
|---|
| 13 | $DbResult = $Database2->query('SELECT MAX(avg) FROM `data_wow_players` WHERE measure=5 AND level=0 AND time<NOW() AND time > (NOW() - INTERVAL 1 DAY)');
|
|---|
| 14 | $Row = $DbResult->fetch_array();
|
|---|
| 15 | $YesterdayMaxPlayers = $Row[0];
|
|---|
| 16 | $AllowedRegistrationCountPerDay = $Config['Mangos']['RequiredOnlinePlayers'] - $YesterdayMaxPlayers;
|
|---|
| 17 | if($AllowedRegistrationCountPerDay < 0) $AllowedRegistrationCountPerDay = 0;
|
|---|
| 18 |
|
|---|
| 19 | $ConfigFile = fopen('reg_config.php', 'w+');
|
|---|
| 20 | fputs($ConfigFile, '<?php'."\n");
|
|---|
| 21 | fputs($ConfigFile, '$AllowedRegistrationCountPerDay = '.$AllowedRegistrationCountPerDay.';'."\n");
|
|---|
| 22 | fputs($ConfigFile, '$YesterdayMaxPlayers = '.$YesterdayMaxPlayers.'; '."\n");
|
|---|
| 23 | fputs($ConfigFile, '$MaximumAccountCount = '.($AccountCount+$AllowedRegistrationCountPerDay).'; '."\n");
|
|---|
| 24 | fputs($ConfigFile, '?>'."\n");
|
|---|
| 25 | fclose($ConfigFile);
|
|---|
| 26 |
|
|---|
| 27 | ?>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.