source: branches/old/check_registration.php

Last change on this file was 448, checked in by george, 16 years ago
  • Přesunuto: Obsah kořenové složky byl přesunut do složky trunk a beta web přesunut do branches/beta.
File size: 1.7 KB
Line 
1<?php
2include('../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;
17if($AllowedRegistrationCountPerDay < 0) $AllowedRegistrationCountPerDay = 0;
18
19$ConfigFile = fopen('reg_config.php', 'w+');
20fputs($ConfigFile, '<?php'."\n");
21fputs($ConfigFile, '$AllowedRegistrationCountPerDay = '.$AllowedRegistrationCountPerDay.';'."\n");
22fputs($ConfigFile, '$YesterdayMaxPlayers = '.$YesterdayMaxPlayers.'; '."\n");
23fputs($ConfigFile, '$MaximumAccountCount = '.($AccountCount+$AllowedRegistrationCountPerDay).'; '."\n");
24fputs($ConfigFile, '?>'."\n");
25fclose($ConfigFile);
26
27$ConfigFile2 = fopen('../beta/pages/reg_config.php', 'w+');
28fputs($ConfigFile2, '<?php'."\n");
29fputs($ConfigFile2, '$AllowedRegistrationCountPerDay = '.$AllowedRegistrationCountPerDay.';'."\n");
30fputs($ConfigFile2, '$YesterdayMaxPlayers = '.$YesterdayMaxPlayers.'; '."\n");
31fputs($ConfigFile2, '$MaximumAccountCount = '.($AccountCount+$AllowedRegistrationCountPerDay).'; '."\n");
32fputs($ConfigFile2, '?>'."\n");
33fclose($ConfigFile2);
34
35?>
Note: See TracBrowser for help on using the repository browser.