forked from Luis-J-Ianez/cubecomps.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addround.php
35 lines (34 loc) · 880 Bytes
/
addround.php
1
2
3
4
5
6
7
8
9
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
<?
require_once "lib.php";
include "lib_ref_admin.php";
if ($_GET["id"])
{
include "db.php";
//
$result = strict_mysql_query("SELECT * FROM $eventstable WHERE id=".$_GET["id"]);
if (mysql_num_rows($result)==1)
{
$event = cased_mysql_fetch_array($result);
$round = 0;
do {
$round += 1;
} while($round < 4 && $event["r".$round]);
$rnd = "r".$round;
if (!$event[$rnd])
{
$prnd = "r".($round-1);
if ($event[$prnd."_open"])
$gs = mysql_num_rows(strict_mysql_query("SELECT round FROM $regstable WHERE cat_id=".$_GET["id"]." AND round=".($round-1)));
else
$gs = $event[$prnd."_groupsize"];
$gs = floor($gs*.75);
if ($gs >= 2)
{
strict_mysql_query("UPDATE $eventstable SET ". $rnd."=1, ". $rnd."_format=". $prnd."_format, " .$rnd."_groupsize=". $gs.", " .$rnd."_open=0 WHERE id=" . $_GET["id"]);
}
}
}
//
mysql_close();
}
?>