- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
if(!$result = MYSQL_QUERY("SELECT gmr_id, gam_chip, gam_price, gam_status FROM ".PREFIX."_games;")) { die(mysql_error()); exit; }
if(MYSQL_NUMROWS($result))
{
while($rows = mysql_fetch_row($result))
{
if(isset($gmr_chip[$rows[0]])) $gmr_chip[$rows[0]] += $rows[1];
else $gmr_chip[$rows[0]] = $rows[1];
if(isset($gmr_price[$rows[0]])) $gmr_price[$rows[0]] += $rows[2];
else $gmr_price[$rows[0]] = $rows[2];
}
}
if(!$result = MYSQL_QUERY("SELECT gmr_id, gmr_regdate, gmr_login, gmr_mail, gmr_credits, gmr_money, gmr_status, gmr_birthday, adv_id FROM ".PREFIX."_gamers WHERE gmr_birthday != '';")) { die(mysql_error()); exit; }
if(MYSQL_NUMROWS($result))
{
while($rows = mysql_fetch_row($result))
{
$gmr_id[$rows[0]] = $rows[0];
$gmr_regdate[$rows[0]] = $rows[1];
$gmr_login[$rows[0]] = $rows[2];
$gmr_mail[$rows[0]] = $rows[3];
$gmr_credits[$rows[0]] = $rows[4];
$gmr_money[$rows[0]] = $rows[5];
$gmr_status[$rows[0]] = $rows[6];
$gmr_birthday[$rows[0]] = $rows[7];
if(!isset($gmr_quations[$rows[0]])) $gmr_quations[$rows[0]] = 0;
if(!isset($gmr_chip[$rows[0]])) $gmr_chip[$rows[0]] = 0;
if(!isset($gmr_price[$rows[0]])) $gmr_price[$rows[0]] = 0;
if(isset($gmr_adverted[$rows[8]])) $gmr_adverted[$rows[8]]++;
else $gmr_adverted[$rows[8]] = 1;
$gadv_id[$rows[0]] = $rows[8];
}
}
MYSQL_QUERY("DROP TABLE ".PREFIX."_tmp_gamers;");
if (!mysql_query ("CREATE TABLE ".PREFIX."_tmp_gamers (
gmr_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
gmr_regdate DATE NOT NULL,
gmr_login CHAR(32) NOT NULL,
gmr_mail CHAR(32) NOT NULL,
gmr_credits INT UNSIGNED NOT NULL,
gmr_money DEC(10, 2) UNSIGNED NOT NULL,
gmr_status INT UNSIGNED NOT NULL,
gmr_birthday CHAR(12) NOT NULL,
gmr_quations INT UNSIGNED NOT NULL,
gmr_chip DEC(10, 2) UNSIGNED NOT NULL,
gmr_price DEC(10, 2) UNSIGNED NOT NULL,
gmr_adverted INT UNSIGNED NOT NULL,
adv_id INT UNSIGNED NOT NULL,
UNIQUE KEY (gmr_id));")) { die(mysql_error()); exit; }
$first = true;
$query = "INSERT INTO ".PREFIX."_tmp_gamers VALUES ";
if(isset($gmr_id))
{
foreach($gmr_id as $key)
{
if(!$first) $query .= ', ';
else $first = false;
if(!isset($gmr_adverted[$key])) $gmr_adverted[$key] = 0;
$query .= "($gmr_id[$key], '$gmr_regdate[$key]', '$gmr_login[$key]', '$gmr_mail[$key]', $gmr_credits[$key], $gmr_money[$key], $gmr_status[$key], '$gmr_birthday[$key]', $gmr_quations[$key], $gmr_chip[$key], $gmr_price[$key], $gmr_adverted[$key], $gadv_id[$key])";
}
$query .= ";";
if(!MYSQL_QUERY($query)) { die(mysql_error()); exit; }
}
unset($gmr_id);
unset($gmr_regdate);
unset($gmr_login);
unset($gmr_mail);
unset($gmr_credits);
unset($gmr_money);
unset($gmr_status);
unset($gmr_birthday);
unset($gmr_quations);
unset($gmr_chip);
unset($gmr_price);
unset($gmr_adverted);
unset($gadv_id);
$type = 'norm';