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 | $ConfigFile2 = fopen('../beta/pages/reg_config.php', 'w+');
|
---|
28 | fputs($ConfigFile2, '<?php'."\n");
|
---|
29 | fputs($ConfigFile2, '$AllowedRegistrationCountPerDay = '.$AllowedRegistrationCountPerDay.';'."\n");
|
---|
30 | fputs($ConfigFile2, '$YesterdayMaxPlayers = '.$YesterdayMaxPlayers.'; '."\n");
|
---|
31 | fputs($ConfigFile2, '$MaximumAccountCount = '.($AccountCount+$AllowedRegistrationCountPerDay).'; '."\n");
|
---|
32 | fputs($ConfigFile2, '?>'."\n");
|
---|
33 | fclose($ConfigFile2);
|
---|
34 |
|
---|
35 | ?>
|
---|