Example #1
0
<?
require_once "lib_ref_admin.php";
require_once "lib.php";
require_once "lib_get.php";

$cat_id = _GET_num("cat_id");
$round = _GET_num("round");

if ($cat_id && $round)
{
	require_once "db.php";
	//
	$event = strict_query("SELECT * FROM $eventstable WHERE id=?", array($cat_id));
	if (sql_num_rows($event) && cased_mysql_result($event,0,"r".$round) && !cased_mysql_result($event,0,"r".$round."_open"))
	{
		if ($round==1)
		{
			$comp_in = strict_query("SELECT id FROM $compstable WHERE cat?!='' ORDER BY id LIMIT " .cased_mysql_result($event,0,"r".$round."_groupsize"), array($cat_id));
			$registered = sql_num_rows($comp_in);
			if (!$registered) die("Cannot open this round: no one registered");
			for ($x=0;$x<$registered;$x++)
			{
				strict_query("INSERT INTO $regstable VALUES (?,?," .cased_mysql_result($comp_in,$x,"id").")", array($cat_id,$round));
				strict_query("UPDATE $compstable SET cat?='X' WHERE id=".cased_mysql_result($comp_in,$x,"id"), array($cat_id));
			}
		}
		else
		{
			$timetype = cased_mysql_result(strict_query("SELECT timetype FROM categories WHERE id=?", array($cat_id)),0,"timetype");
			$format = strict_query("SELECT * FROM formats WHERE id=".cased_mysql_result($event,0,"r".($round-1)."_format"));
			$avgtype = cased_mysql_result($format,0,"avgtype");
Example #2
0
//=========================================================================================================================

if (!array_key_exists("cid", $_GET))
{
	header("Location: http://".DOMAIN."\r\n");
}
else
{
	if(!isset($_SESSION)) session_start();
	$test = preg_match("~^test\\.~i",$_SERVER["HTTP_HOST"]);
	$cid = _GET_num("cid");
	$comp_id = _GET_num("compid");
	$schedule = _GET_num("schedule");
	$_GETcat = _GET_num("cat");
	$_GETrnd = _GET_num("rnd");
	$_GETsm = _GET_num("sm");
	$showmode = ($_GETcat && $_GETrnd && !$comp_id ? $_GETsm : false);

	$html_sch = DIR_UPLOADS.($test?"test_":"")."sch_$cid.html";
	if (!file_exists($html_sch)) $html_sch = "";
	$txt_sch = DIR_UPLOADS.($test?"test_":"")."sch_$cid.txt";
	if (!file_exists($txt_sch))
	{
		$txt_sch = "";
		if (!$html_sch) $schedule = false;
	}
	elseif (!$_GETcat && !$comp_id && !$schedule)
		$schedule = true;

	if ($test)
	{
Example #3
0
<?
require_once "lib.php";
require_once "lib_ref_admin.php";
require_once "lib_get.php";

$_GETid = _GET_num("id");

if ($_GETid) 
{
	require_once "db.php";
	//
	$result = strict_query("SELECT * FROM $eventstable WHERE id=?", array($_GETid));
	if (sql_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 = sql_num_rows(strict_query("SELECT round FROM $regstable WHERE cat_id=? AND round=?", array($_GETid,$round-1)));
			else
				$gs = $event[$prnd."_groupsize"];
			$gs = floor($gs*.75);
			if ($gs >= 2)
			{
				strict_query("UPDATE $eventstable SET ". $rnd."=1, ". $rnd."_format=". $prnd."_format, " .$rnd."_groupsize=". $gs.", " .$rnd."_open=0 WHERE id=?", array($_GETid));
Example #4
0
		//
		$this->TextCL($dx+15,$dy+55,50,10,"results",true);
		$this->TextCL($dx+67,$dy+55,28,10,"judge",true);
		//
		for ($y=1;$y<=$ntimes;$y++) $this->BoxesLine ($y, $dx,$dy);
		$this->BoxesLine ($y+0.5, $dx,$dy);
		//
		$this->column = !$this->column;
		if (!$this->column) $this->row = !$this->row;
	}
}

$sebastien = 55; // Auroux
$cat_id = _GET_num("cat_id");
$round = _GET_num("round");
$comp_id = _GET_num("comp_id");
if (($cat_id && $round) || $comp_id)
{
	if ($comp_id)
		$result = strict_query("SELECT $regstable.comp_id AS compid, $regstable.cat_id AS catid, $regstable.round AS round, categories.name AS catname, $compstable.name AS compname FROM $regstable JOIN categories ON $regstable.cat_id=categories.id JOIN $compstable ON $regstable.comp_id=$compstable.id WHERE $regstable.comp_id=? AND $regstable.round=1 ORDER BY categories.id", array($comp_id));
	else
	{
		$query = "SELECT $regstable.comp_id AS compid, categories.name AS catname, $compstable.name AS compname FROM $regstable JOIN categories ON $regstable.cat_id=categories.id JOIN $compstable ON $regstable.comp_id=$compstable.id";
		if ($round>1)
		{
			$query .= " JOIN $timestable ON $timestable.cat_id=$regstable.cat_id AND $timestable.round=? AND $timestable.comp_id=$regstable.comp_id";
			$array = array($round-1,$cat_id,$round);
		}
		else
			$array = array($cat_id,$round);
		$query .= " WHERE $regstable.cat_id=? AND $regstable.round=?";
Example #5
0
if ($_GETid && $_GETfld && isset($_GET["value"])) 
{
	require_once "db.php";
	//
	if ($_GETfld=="timelimit")
	{
		$value = _GET_key("value"); // still secure because of the following lines
		if ($value && !preg_match("/^([0-9]{1,2}\072[0-5][0-9]\056[0-9]{2}|[0-5]?[0-9]\056[0-9]{2}|[0-9]{1,2}\072[0-5][0-9])$/",$value))
			$value = "";
		if ($value)
		{
			$value = formatTimelimit00($value);
			if (!timelimitNum00($value)) $value = "";
		}
	}
	else
		$value = _GET_num("value");
	//
	strict_query("UPDATE $eventstable SET $_GETfld=? WHERE id=?", array($value,$_GETid));
	//
	if ($_GETfld=="timelimit")
		if ($value)
			$value = "cutoff $value";
		else
			$value = "no cutoff";
	echo $value;
	//
	sql_close();
}
?>
<?
require_once "lib_reg.php";
require_once "lib_ref_admin.php";
require_once "lib_get.php";

$comp_id = _GET_num("comp_id");
$cat_id = _GET_num("cat_id");

if ($comp_id && $cat_id) 
{
	require_once "db.php";
	echo toggleReg($comp_id,$cat_id);
	sql_close();
}
?>