Many updates of queries, switching from usage of FAIRYEAR to conference_id.

This commit is contained in:
jacob 2010-11-01 15:24:59 +00:00
parent 4f35702bbf
commit 21261a99af
42 changed files with 312 additions and 266 deletions

View File

@ -215,7 +215,7 @@ TRACE("Grid size: {$grid_size}m\n");
$div = array(); $div = array();
TRACE("Loading Project Divisions...\n"); TRACE("Loading Project Divisions...\n");
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
$divshort[$r->id]=$r->division_shortform; $divshort[$r->id]=$r->division_shortform;
@ -225,7 +225,7 @@ while($r=mysql_fetch_object($q))
TRACE("Loading Project Age Categories...\n"); TRACE("Loading Project Age Categories...\n");
$cat = array(); $cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$catshort[$r->id]=$r->category_shortform; $catshort[$r->id]=$r->category_shortform;
$cat[$r->id]=$r->category; $cat[$r->id]=$r->category;
@ -236,7 +236,7 @@ TRACE("Loading Projects...\n");
$projects = array(); $projects = array();
$q = mysql_query("SELECT projects.* FROM projects, registrations $q = mysql_query("SELECT projects.* FROM projects, registrations
WHERE WHERE
projects.year='{$config['FAIRYEAR']}' projects.conferences_id='{$conference['id']}'
AND registrations.id = projects.registrations_id AND registrations.id = projects.registrations_id
".getJudgingEligibilityCode()); ".getJudgingEligibilityCode());
while($p = mysql_fetch_object($q)) { while($p = mysql_fetch_object($q)) {
@ -597,7 +597,7 @@ for($x=0;$x<$a->num_buckets; $x++) {
print_r($projects); print_r($projects);
/* Assign floor numbers */ /* Assign floor numbers */
mysql_query("UPDATE projects SET floornumber=0 WHERE year='{$config['FAIRYEAR']}'"); mysql_query("UPDATE projects SET floornumber=0 WHERE conferences_id='{$conference['id']}'");
foreach($projects as $pid=>$p) { foreach($projects as $pid=>$p) {
mysql_query("UPDATE projects SET floornumber='{$p['floornumber']}' WHERE id='$pid'"); mysql_query("UPDATE projects SET floornumber='{$p['floornumber']}' WHERE id='$pid'");

View File

@ -27,7 +27,7 @@
user_auth_required('admin'); user_auth_required('admin');
require("../lpdf.php"); require("../lpdf.php");
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'"); $catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' AND id='".$_GET['cat']."'");
if($catr=mysql_fetch_object($catq)) if($catr=mysql_fetch_object($catq))
{ {
@ -48,7 +48,7 @@ if($catr=mysql_fetch_object($catq))
registrations registrations
left outer join projects on projects.registrations_id=registrations.id left outer join projects on projects.registrations_id=registrations.id
WHERE WHERE
registrations.year='".$config['FAIRYEAR']."' registrations.conferences_id='".$conference['id']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending' ) AND ( registrations.status='complete' OR registrations.status='paymentpending' )
AND projects.projectcategories_id='$catr->id' AND projects.projectcategories_id='$catr->id'
ORDER BY ORDER BY
@ -74,7 +74,7 @@ if($catr=mysql_fetch_object($catq))
} }
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
$divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); $divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE conferences_id='".$conference['id']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq); $divr=mysql_fetch_object($divq);
$sq=mysql_query("SELECT students.firstname, $sq=mysql_query("SELECT students.firstname,

View File

@ -56,14 +56,14 @@ function newbuttonclicked(jdivs)
$div = array(); $div = array();
$divshort = array(); $divshort = array();
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$divshort[$r->id]=$r->division_shortform; $divshort[$r->id]=$r->division_shortform;
$div[$r->id]=$r->division; $div[$r->id]=$r->division;
} }
$cat = array(); $cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$cat[$r->id]=$r->category; $cat[$r->id]=$r->category;
} }
@ -72,7 +72,7 @@ function newbuttonclicked(jdivs)
$ckeys = array_keys($cat); $ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") { if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id"); $q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array(); $divcat=array();
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id); $divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
@ -97,7 +97,7 @@ function newbuttonclicked(jdivs)
function get_all_divs() function get_all_divs()
{ {
global $config; global $config, $conference;
global $divshort, $div,$cat, $langr; global $divshort, $div,$cat, $langr;
global $divcat; global $divcat;
@ -157,7 +157,7 @@ function get_all_divs()
" projectdivisions_id='{$cdl[$id]['div']}' ". " projectdivisions_id='{$cdl[$id]['div']}' ".
" AND projectcategories_id='{$cdl[$id]['cat']}' ". " AND projectcategories_id='{$cdl[$id]['cat']}' ".
" AND language='{$cdl[$id]['lang']}' ". " AND language='{$cdl[$id]['lang']}' ".
" AND registrations.year='{$config['FAIRYEAR']}'". " AND registrations.conferences_id='{$conference['id']}'".
" AND projects.registrations_id=registrations.id". " AND projects.registrations_id=registrations.id".
" AND (registrations.status='complete' OR registrations.status='paymentpending')"); " AND (registrations.status='complete' OR registrations.status='paymentpending')");

View File

@ -87,11 +87,11 @@ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id']) if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id'])
{ {
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')"); mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,conferences_id) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$conference['id']."')");
echo happy(i18n("Project assigned to team timeslot")); echo happy(i18n("Project assigned to team timeslot"));
} }
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1) if(mysql_num_rows($q)>1)
$show_date=true; $show_date=true;
else else
@ -212,7 +212,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
projectnumber is not null projectnumber is not null
" . getJudgingEligibilityCode(). " AND " . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND projects.registrations_id=registrations.id AND
projects.year='".$config['FAIRYEAR']."' projects.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectnumber"; projectnumber";
} }
@ -232,7 +232,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
" . getJudgingEligibilityCode(). " AND " . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND projects.registrations_id=registrations.id AND
judges_teams_timeslots_projects_link.projects_id IS NULL AND judges_teams_timeslots_projects_link.projects_id IS NULL AND
projects.year='".$config['FAIRYEAR']."' projects.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectnumber"; projectnumber";
} }
@ -300,7 +300,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectnumber projectnumber
"); ");
@ -407,7 +407,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."' judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectnumber projectnumber
"); ");

View File

@ -32,7 +32,6 @@
'Judging Score Entry' => 'admin/judging_score_entry.php') 'Judging Score Entry' => 'admin/judging_score_entry.php')
); );
$year=$config['FAIRYEAR'];
$project_id = NULL; $project_id = NULL;
if($_GET['projectid']) { if($_GET['projectid']) {
$project_id = $_GET['projectid']; $project_id = $_GET['projectid'];
@ -50,7 +49,7 @@
mysql_query("UPDATE judges_teams_timeslots_projects_link mysql_query("UPDATE judges_teams_timeslots_projects_link
SET score=" . $score . SET score=" . $score .
" WHERE judges_teams_id = " . mysql_real_escape_string($_POST["team_" . $curr_team . "_id"]) . " WHERE judges_teams_id = " . mysql_real_escape_string($_POST["team_" . $curr_team . "_id"]) .
" and projects_id =$project_id and year=$year"); " and projects_id =$project_id and conferences_id={$conference['id']}");
echo mysql_error(); echo mysql_error();
} }
$curr_team--; $curr_team--;
@ -60,11 +59,11 @@
?> ?>
<? <?
if($project_id) { if($project_id) {
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category; $cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id");
$q=mysql_query("SELECT judges_teams_timeslots_projects_link.judges_teams_id, $q=mysql_query("SELECT judges_teams_timeslots_projects_link.judges_teams_id,

View File

@ -27,8 +27,8 @@
require_once("judges.inc.php"); require_once("judges.inc.php");
user_auth_required('admin'); user_auth_required('admin');
if($_GET['year']) $year=$_GET['year']; if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $year=$config['FAIRYEAR']; else $conferences_id=$conference['id'];
if($_GET['csv'] == 'yes') { if($_GET['csv'] == 'yes') {
header("Content-type: text/csv"); header("Content-type: text/csv");
@ -42,11 +42,11 @@
} }
?> ?>
<? <?
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category; $cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division; $divs[$r->id]=$r->division;
@ -73,7 +73,7 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
left outer join projects on projects.registrations_id=registrations.id left outer join projects on projects.registrations_id=registrations.id
left outer join judges_teams_timeslots_projects_link on projects.id=judges_teams_timeslots_projects_link.projects_id left outer join judges_teams_timeslots_projects_link on projects.id=judges_teams_timeslots_projects_link.projects_id
WHERE WHERE
registrations.year='$year' " registrations.conferences_id='$conferences_id' "
. getJudgingEligibilityCode() . " . getJudgingEligibilityCode() . "
GROUP BY projectid GROUP BY projectid
ORDER BY ORDER BY
@ -163,7 +163,7 @@ $(document).ready(function() {
} }
echo number_format($r->score_count, 0) . "/" . number_format($r->score_total_count, 0) . "</td>\n"; echo number_format($r->score_count, 0) . "/" . number_format($r->score_total_count, 0) . "</td>\n";
echo "<td align=\"center\">"; echo "<td align=\"center\">";
if($year==$config['FAIRYEAR']) { if($conferences_id == $conference['id']){
echo "<a href=\"judging_score_edit.php?projectid=$r->projectid\">"; echo "<a href=\"judging_score_edit.php?projectid=$r->projectid\">";
echo i18n("Edit Scores"); echo i18n("Edit Scores");
echo "</a>"; echo "</a>";

View File

@ -42,7 +42,7 @@ if($auth_type == 'fair') {
the master copy of the fairs_id in the project */ the master copy of the fairs_id in the project */
$q=mysql_query("SELECT * FROM projects WHERE $q=mysql_query("SELECT * FROM projects WHERE
registrations_id='$registrations_id' registrations_id='$registrations_id'
AND year='{$config['FAIRYEAR']}' AND conferences_id='{$conference['id']}'
AND fairs_id=$fairs_id"); AND fairs_id=$fairs_id");
if(mysql_num_rows($q) != 1) { if(mysql_num_rows($q) != 1) {
echo "permission denied."; echo "permission denied.";
@ -62,7 +62,7 @@ case 'project_regenerate_number':
project_save(); project_save();
/* Now generate */ /* Now generate */
$q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$i=mysql_fetch_assoc($q); $i=mysql_fetch_assoc($q);
$id = $i['id']; $id = $i['id'];
@ -89,10 +89,10 @@ exit;
function project_save() function project_save()
{ {
global $registrations_id, $config; global $registrations_id, $config, $conference;
//first, lets make sure this project really does belong to them //first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
if(!projectinfo) { if(!projectinfo) {
echo error(i18n("Invalid project to update")); echo error(i18n("Invalid project to update"));
@ -128,7 +128,7 @@ function project_save()
//check if they changed the project number //check if they changed the project number
if($_POST['projectnumber']!=$projectinfo->projectnumber) { if($_POST['projectnumber']!=$projectinfo->projectnumber) {
//check if hte new one is available //check if hte new one is available
$q=mysql_query("SELECT * FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber='".$_POST['projectnumber']."'"); $q=mysql_query("SELECT * FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber='".$_POST['projectnumber']."'");
if(mysql_num_rows($q)) { if(mysql_num_rows($q)) {
error_("Could not change project number. %1 is already in use",array($_POST['projectnumber'])); error_("Could not change project number. %1 is already in use",array($_POST['projectnumber']));
} else { } else {
@ -143,14 +143,14 @@ function project_save()
function project_load() function project_load()
{ {
global $registrations_id, $config; global $registrations_id, $config, $conference;
//now lets find out their MAX grade, so we can pre-set the Age Category //now lets find out their MAX grade, so we can pre-set the Age Category
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'"); $q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
$gradeinfo=mysql_fetch_object($q); $gradeinfo=mysql_fetch_object($q);
//now lets grab all the age categories, so we can choose one based on the max grade //now lets grab all the age categories, so we can choose one based on the max grade
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
//save these in an array, just incase we need them later (FIXME: remove this array if we dont need it) //save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
$agecategories[$r->id]['category']=$r->category; $agecategories[$r->id]['category']=$r->category;
@ -162,7 +162,7 @@ function project_load()
} }
//now select their project info //now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one //check if it exists, if we didnt find any record, lets insert one
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
@ -229,11 +229,11 @@ function countwords()
<? <?
//###### Feature Specific - filtering divisions by category //###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){ if($config['filterdivisionbycategory']=="yes"){
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division"); $q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division");
echo mysql_error(); echo mysql_error();
//### //###
} else } else
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division");
echo "<select name=\"projectdivisions_id\">"; echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n"; echo "<option value=\"\">".i18n("Select a division")."</option>\n";

View File

@ -38,7 +38,7 @@
'cost' => 'Cost', 'cost' => 'Cost',
'per' => 'Cost Per', 'per' => 'Cost Per',
), null, ), null,
array('year' => $config['FAIRYEAR']) array('conference' => $conference['name'])
); );
$editor->setPrimaryKey("id"); $editor->setPrimaryKey("id");
@ -48,7 +48,7 @@
array('key' => 'project', 'val' => "Project") array('key' => 'project', 'val' => "Project")
) ); ) );
$editor->setFieldInputType("per", 'select'); $editor->setFieldInputType("per", 'select');
$editor->filterList('year',$config['FAIRYEAR']); $editor->filterList('conference',$conference['name']);
$editor->execute(); $editor->execute();

View File

@ -29,14 +29,14 @@ $auth_type = user_auth_required(array(), array('fair', 'admin'));
//require_once('../register_participants.inc.php'); //require_once('../register_participants.inc.php');
if($_GET['year']) $year=$_GET['year']; if($_GET['conference_id']) $conference_id=$_GET['conference_id'];
else $year=$config['FAIRYEAR']; else $conference_id=$conference['id']
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category; $cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division; $divs[$r->id]=$r->division;
@ -44,7 +44,7 @@ $action=$_GET['action'];
switch($action) { switch($action) {
case 'load_row': case 'load_row':
$id = intval($_GET['id']); $id = intval($_GET['id']);
$q = list_query($year, '', $id); $q = list_query($conference_id, '', $id);
$r = mysql_fetch_object($q); $r = mysql_fetch_object($q);
print_row($r); print_row($r);
exit; exit;
@ -56,13 +56,13 @@ case 'delete':
$p = mysql_fetch_assoc($q); $p = mysql_fetch_assoc($q);
mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'"); mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'");
} }
mysql_query("DELETE FROM registrations WHERE id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM registrations WHERE id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); // mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
happy_("Registration and all related data successfully deleted"); happy_("Registration and all related data successfully deleted");
exit; exit;
} }
@ -347,7 +347,7 @@ if($showstatus) {
} }
else $wherestatus=""; else $wherestatus="";
$q = list_query($year, $wherestatus, false); $q = list_query($conference_id, $wherestatus, false);
echo "<table id=\"registration_list\" class=\"tableview\">"; echo "<table id=\"registration_list\" class=\"tableview\">";
echo "<thead><tr>"; echo "<thead><tr>";
@ -379,7 +379,7 @@ echo "<br/><br/>The statistics have moved here: <a href=\"registration_stats.php
send_footer(); send_footer();
/* Now some helper fucntions we call more than once */ /* Now some helper fucntions we call more than once */
function list_query($year, $wherestatus, $reg_id) function list_query($conference_id, $wherestatus, $reg_id)
{ {
global $auth_type; global $auth_type;
@ -405,7 +405,7 @@ function list_query($year, $wherestatus, $reg_id)
left outer join projects on projects.registrations_id=registrations.id left outer join projects on projects.registrations_id=registrations.id
WHERE WHERE
1 1
AND registrations.year='$year' AND registrations.conferences_id='$conference_id'
$wherestatus $wherestatus
$reg $fair $reg $fair
ORDER BY ORDER BY
@ -419,7 +419,7 @@ function list_query($year, $wherestatus, $reg_id)
function print_row($r) function print_row($r)
{ {
global $cats, $divs, $config, $year; global $cats, $divs, $config, $conference_id, $conference;
switch($r->status) { switch($r->status) {
case "new": $status_text="New"; break; case "new": $status_text="New"; break;
case "open": $status_text="Open"; break; case "open": $status_text="Open"; break;
@ -469,7 +469,7 @@ function print_row($r)
echo "<td $scl>$schools</td>"; echo "<td $scl>$schools</td>";
echo "<td $scl>$students</td>"; echo "<td $scl>$students</td>";
echo "<td align=\"center\" >"; echo "<td align=\"center\" >";
if($year==$config['FAIRYEAR']) { if($conference_id==$conference['id']) {
echo "<a title=\"".i18n("Delete this registration")."\" href=\"#\" onClick=\"delete_registration({$r->reg_id});return false\" >"; echo "<a title=\"".i18n("Delete this registration")."\" href=\"#\" onClick=\"delete_registration({$r->reg_id});return false\" >";
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0>"; echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0>";
echo "</a>"; echo "</a>";

View File

@ -37,7 +37,7 @@
$showformatbottom=true; $showformatbottom=true;
if($_POST['action']=="received" && $_POST['registration_number']) if($_POST['action']=="received" && $_POST['registration_number'])
{ {
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1) if(mysql_num_rows($q)==1)
{ {
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
@ -204,11 +204,11 @@ echo mysql_Error();
FROM projects, registrations FROM projects, registrations
WHERE projects.registrations_id = registrations.id WHERE projects.registrations_id = registrations.id
AND num='$regnum' AND num='$regnum'
AND registrations.year='{$config['FAIRYEAR']}'"); AND registrations.conferences_id='{$conference['id']}'");
$checkNumResults=mysql_fetch_object($checkNumQuery); $checkNumResults=mysql_fetch_object($checkNumQuery);
$projectnum=$checkNumResults->projectnumber; $projectnum=$checkNumResults->projectnumber;
$q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
$reg_id = $r->id; $reg_id = $r->id;
@ -217,7 +217,7 @@ echo mysql_Error();
list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id); list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id);
mysql_query("UPDATE projects SET projectnumber='$projectnumber', mysql_query("UPDATE projects SET projectnumber='$projectnumber',
projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss' projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss'
WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'");
echo happy(i18n("Assigned Project Number: %1",array($projectnumber))); echo happy(i18n("Assigned Project Number: %1",array($projectnumber)));
} }
else else
@ -229,7 +229,7 @@ echo mysql_Error();
if($_POST['action']=="receivedyes") if($_POST['action']=="receivedyes")
{ {
//actually set it to 'complete' //actually set it to 'complete'
mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) { foreach($recipients AS $recip) {
$to=$recip['to']; $to=$recip['to'];
@ -251,7 +251,7 @@ echo mysql_Error();
else if($_POST['action']=="receivedyesnocash") else if($_POST['action']=="receivedyesnocash")
{ {
//actually set it to 'paymentpending' //actually set it to 'paymentpending'
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'"); mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) { foreach($recipients AS $recip) {
$to=$recip['to']; $to=$recip['to'];
@ -278,10 +278,10 @@ echo mysql_Error();
} }
else if($_GET['action']=="unregister" && $_GET['registration_number']) { else if($_GET['action']=="unregister" && $_GET['registration_number']) {
$reg_num=intval(trim($_GET['registration_number'])); $reg_num=intval(trim($_GET['registration_number']));
$q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'"); $q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.conferences_id='{$conference['id']}' AND registrations.num='$reg_num'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND year='{$config['FAIRYEAR']}'"); mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND conferences_id='{$conference['id']}'");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND year='{$config['FAIRYEAR']}'"); mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND conferences_id='{$conference['id']}'");
echo happy(i18n("Successfully unregistered project")); echo happy(i18n("Successfully unregistered project"));
} }

View File

@ -27,8 +27,8 @@
user_auth_required('admin'); user_auth_required('admin');
require("../register_participants.inc.php"); require("../register_participants.inc.php");
if($_GET['year']) $year=$_GET['year']; if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $year=$config['FAIRYEAR']; else $conferences_id=$conference['id'];
send_header("Registration Statistics", send_header("Registration Statistics",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
@ -61,11 +61,11 @@
echo "</select>"; echo "</select>";
echo "</form>"; echo "</form>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category; $cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division; $divs[$r->id]=$r->division;
@ -104,7 +104,7 @@ else $wherestatus="";
left outer join projects on projects.registrations_id=registrations.id left outer join projects on projects.registrations_id=registrations.id
WHERE WHERE
1 1
AND registrations.year='$year' AND registrations.conferences_id='$conferences_id'
$wherestatus $wherestatus
ORDER BY ORDER BY
$ORDERBY $ORDERBY

View File

@ -86,9 +86,9 @@
students.registrations_id=registrations.id students.registrations_id=registrations.id
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' ) AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
AND projects.registrations_id=registrations.id AND projects.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."' AND registrations.conferences_id='".$conference['id']."'
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND students.year='".$config['FAIRYEAR']."' AND students.conferences_id='".$conference['id']."'
ORDER BY projectnumber ORDER BY projectnumber
"); ");
echo mysql_error(); echo mysql_error();

View File

@ -20,7 +20,8 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
$report_awards_fields = array( $report_awards_fields = array(
'name' => array( 'name' => array(
'start_option_group' => 'Award Information', 'start_option_group' => 'Award Information',
@ -355,7 +356,7 @@ $report_awards_fields = array(
'name' => 'Fair -- Year', 'name' => 'Fair -- Year',
'header' => 'Year', 'header' => 'Year',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"), 'table' => $fairYear),
'fair_logo' => array( 'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)', 'name' => 'Fair -- Logo (for Labels only)',

View File

@ -20,6 +20,8 @@
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
$report_fairs_fields = array( $report_fairs_fields = array(
'fairinfo_name' => array( 'fairinfo_name' => array(
@ -402,7 +404,7 @@ $report_fairs_fields = array(
'name' => 'Fair -- Year', 'name' => 'Fair -- Year',
'header' => 'Year', 'header' => 'Year',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"), 'table' => $fairYear),
'fair_logo' => array( 'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)', 'name' => 'Fair -- Logo (for Labels only)',
@ -418,7 +420,7 @@ $report_fairs_fields = array(
); );
function report_fairs_fromwhere($report, $components) function report_fairs_fromwhere($report, $components) /// FIXME - this isn't updated to use the conference['id'], but I don't see it used anywhere in the code anyway. Delete?
{ {
global $config, $report_fairs_fields; global $config, $report_fairs_fields;

View File

@ -30,6 +30,8 @@ function report_fundraisings_languages(&$report, $field, $text)
return join(' ', $l); return join(' ', $l);
} }
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
/* Components: */ /* Components: */
@ -164,7 +166,7 @@ $report_fundraisings_fields = array(
'name' => 'Fair -- Year', 'name' => 'Fair -- Year',
'header' => 'Year', 'header' => 'Year',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"), 'table' => $fairYear),
'fair_logo' => array( 'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)', 'name' => 'Fair -- Logo (for Labels only)',

View File

@ -417,9 +417,9 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") {
*/ */
function getEmailRecipientsForRegistration($reg_id) function getEmailRecipientsForRegistration($reg_id)
{ {
global $config; global $config, $conference;
//okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents //okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents
$q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND conferences_id='{$conference['id']}'");
$registration=mysql_fetch_object($q); $registration=mysql_fetch_object($q);
if($registration->emailcontact && isEmailAddress($registration->emailcontact)) { if($registration->emailcontact && isEmailAddress($registration->emailcontact)) {
@ -430,7 +430,7 @@ function getEmailRecipientsForRegistration($reg_id)
); );
} }
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); $sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'");
$ret=array(); $ret=array();
while($sr=mysql_fetch_object($sq)) { while($sr=mysql_fetch_object($sq)) {
if($sr->email && isEmailAddress($sr->email)) { if($sr->email && isEmailAddress($sr->email)) {
@ -454,8 +454,8 @@ function getEmailRecipientsForRegistration($reg_id)
} }
function output_page_text($textname) { function output_page_text($textname) {
global $config; global $config, $conference;
$q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='".$config['FAIRYEAR']."' AND lang='".$_SESSION['lang']."'"); $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND conferences_id='".$conference['id']."' AND lang='".$_SESSION['lang']."'");
if(mysql_num_rows($q)) if(mysql_num_rows($q))
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
else { else {
@ -520,7 +520,7 @@ function admin_warnings() {
//warnings to show to both config and/or admin people //warnings to show to both config and/or admin people
function committee_warnings() { function committee_warnings() {
global $config; global $config, $conference;
//it is vital that each year the system be rolled over before we start it again //it is vital that each year the system be rolled over before we start it again
//we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see //we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see
//the message as soon as they login to start preparing for hte new year, but not too late to do it //the message as soon as they login to start preparing for hte new year, but not too late to do it
@ -542,7 +542,7 @@ function committee_warnings() {
$qq = mysql_query("SELECT * FROM award_awards $qq = mysql_query("SELECT * FROM award_awards
LEFT JOIN fairs ON fairs.id=award_awards.award_source_fairs_id LEFT JOIN fairs ON fairs.id=award_awards.award_source_fairs_id
WHERE award_awards.id='{$p['award_awards_id']}' WHERE award_awards.id='{$p['award_awards_id']}'
AND year='{$config['FAIRYEAR']}' AND conferences_id='{$conference['id']}'
AND award_awards.award_source_fairs_id IS NOT NULL AND award_awards.award_source_fairs_id IS NOT NULL
AND fairs.type='ysc' "); AND fairs.type='ysc' ");
echo mysql_error(); echo mysql_error();

View File

@ -1 +1 @@
216 217

41
db/db.update.217.php Normal file
View File

@ -0,0 +1,41 @@
<?
function db_update_217_pre()
{
}
function db_update_217_post()
{
$tables=array(
'pagetext',
'emergencycontact',
'safetyquestions',
'tours',
'tours_choice',
'regfee_items',
'mentors',
'schools',
'project_specialawards_link',
'safety',
'safetyquestions'
);
// add the conferences_id field
foreach($tables as $tableName){
$query = "ALTER TABLE `$tableName` ADD `conferences_id` INT NOT NULL";
mysql_query($query);
echo $query . ";\n";
}
// get the year => conference_id links
$q1 = mysql_query("SELECT year, id FROM conferences WHERE year > 0");
// add the conferences_id field to each table
while($r = mysql_fetch_assoc($q1)){
foreach($tables as $tableName){
$query = "UPDATE `$tableName` SET `conferences_id` = {$r['id']} WHERE `year` = {$r['year']}";
mysql_query($query);
echo $query . ";\n";
}
}
}
?>

View File

@ -131,7 +131,7 @@ echo "<div id=\"expertise_info_status\"></div>\n";
echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n"; echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n";
echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n"; echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY mingrade");
echo "<br /><h4>".i18n("Age Category Preferences")."</h4><br>"; echo "<br /><h4>".i18n("Age Category Preferences")."</h4><br>";
echo "<table class=\"editor\" style=\"width: 300px;\" >"; echo "<table class=\"editor\" style=\"width: 300px;\" >";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
@ -171,7 +171,7 @@ echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
echo "<table>\n"; echo "<table>\n";
//query all of the categories //query all of the categories
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY division");
$first = true; $first = true;
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
@ -199,7 +199,7 @@ echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
//only show the sub-divisions if the 'main' division is scored >=3 //only show the sub-divisions if the 'main' division is scored >=3
if($u['div_prefs'][$r->id]>=3) { if($u['div_prefs'][$r->id]>=3) {
$subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND year='".$config['FAIRYEAR']."' ORDER BY subdivision"); $subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND conferences_id='".$conference['id']."' ORDER BY subdivision");
while($subr=mysql_fetch_object($subq)) { while($subr=mysql_fetch_object($subq)) {
echo "<tr>"; echo "<tr>";
echo "<td>&nbsp;</td>"; echo "<td>&nbsp;</td>";

View File

@ -62,7 +62,7 @@
* if there is one, print the judge scheule link in an obvious place, * if there is one, print the judge scheule link in an obvious place,
* it's less obvious below */ * it's less obvious below */
$q = mysql_query("SELECT id FROM judges_teams_link WHERE $q = mysql_query("SELECT id FROM judges_teams_link WHERE
users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}'"); users_id='{$u['id']}' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q) > 0) { if(mysql_num_rows($q) > 0) {
echo '<span style="font-size: 1.2em; font-weight: bold;">'; echo '<span style="font-size: 1.2em; font-weight: bold;">';
echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule", echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule",

View File

@ -46,7 +46,7 @@ $sq = mysql_query("SELECT firstname,lastname,school FROM students
LEFT JOIN schools ON schools.id = students.schools_id LEFT JOIN schools ON schools.id = students.schools_id
WHERE WHERE
registrations_id='{$pi->registrations_id}' registrations_id='{$pi->registrations_id}'
AND students.year='{$config['FAIRYEAR']}'"); AND students.conferences_id='{$conference['id']}'");
$student = array(); $student = array();
while($si = mysql_fetch_object($sq)) { while($si = mysql_fetch_object($sq)) {

View File

@ -75,7 +75,7 @@ if(!$scheduleok) {
$q = mysql_query("SELECT * FROM judges_teams_link $q = mysql_query("SELECT * FROM judges_teams_link
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id
WHERE judges_teams_link.users_id='{$u['id']}' WHERE judges_teams_link.users_id='{$u['id']}'
AND judges_teams_link.year='{$config['FAIRYEAR']}'"); AND judges_teams_link.conferences_id='{$conference['id']}'");
$teams = array(); $teams = array();
while($t = mysql_fetch_assoc($q)) { while($t = mysql_fetch_assoc($q)) {
/* Load timeslot data for this team (team -> judges_timeslots_link -> timeslot -> parent timeslot */ /* Load timeslot data for this team (team -> judges_timeslots_link -> timeslot -> parent timeslot */

View File

@ -24,7 +24,7 @@
<? <?
function getProjectsEligibleForAward($award_id) function getProjectsEligibleForAward($award_id)
{ {
global $config; global $conference;
$prjq=mysql_query("SELECT $prjq=mysql_query("SELECT
award_awards.id, award_awards.id,
@ -46,7 +46,7 @@ function getProjectsEligibleForAward($award_id)
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND projects.projectnumber is not null AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectsort projectsort
"); ");
@ -92,7 +92,7 @@ function getProjectsEligibleOrNominatedForAwards($awards_ids_array)
function getSpecialAwardsEligibleForProject($projectid) function getSpecialAwardsEligibleForProject($projectid)
{ {
global $config; global $conference;
$awardsq=mysql_query("SELECT $awardsq=mysql_query("SELECT
award_awards.id, award_awards.id,
@ -116,10 +116,10 @@ function getSpecialAwardsEligibleForProject($projectid)
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND award_awards.id is not null AND award_awards.id is not null
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid' AND projects.id='$projectid'
AND award_types.year='".$config['FAIRYEAR']."' AND award_types.conferences_id='".$conference['id']."'
AND award_awards.year='".$config['FAIRYEAR']."' AND award_awards.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
award_awards.name award_awards.name
"); ");
@ -139,7 +139,7 @@ function getSpecialAwardsEligibleForProject($projectid)
function getSpecialAwardsNominatedForProject($projectid) function getSpecialAwardsNominatedForProject($projectid)
{ {
global $config; global $conference;
$awardsq=mysql_query("SELECT $awardsq=mysql_query("SELECT
award_awards.id, award_awards.id,
@ -154,7 +154,7 @@ function getSpecialAwardsNominatedForProject($projectid)
WHERE WHERE
project_specialawards_link.projects_id='$projectid' project_specialawards_link.projects_id='$projectid'
AND project_specialawards_link.award_awards_id=award_awards.id AND project_specialawards_link.award_awards_id=award_awards.id
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid' AND projects.id='$projectid'
ORDER BY ORDER BY
award_awards.name award_awards.name
@ -175,7 +175,7 @@ function getSpecialAwardsNominatedForProject($projectid)
function getNominatedForNoSpecialAwardsForProject($projectid) function getNominatedForNoSpecialAwardsForProject($projectid)
{ {
global $config; global $conference;
$awardsq=mysql_query("SELECT $awardsq=mysql_query("SELECT
projects.id AS projects_id projects.id AS projects_id
FROM FROM
@ -183,7 +183,7 @@ function getNominatedForNoSpecialAwardsForProject($projectid)
projects projects
WHERE WHERE
project_specialawards_link.projects_id='$projectid' project_specialawards_link.projects_id='$projectid'
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid' AND projects.id='$projectid'
AND project_specialawards_link.award_awards_id IS NULL AND project_specialawards_link.award_awards_id IS NULL
"); ");
@ -193,7 +193,7 @@ function getNominatedForNoSpecialAwardsForProject($projectid)
function getProjectsNominatedForSpecialAward($award_id) function getProjectsNominatedForSpecialAward($award_id)
{ {
global $config; global $config, $conference;
//if they dont use special award nominations, then we will instead get all of the projects that //if they dont use special award nominations, then we will instead get all of the projects that
//are eligible for the award, instead of nominated for it. //are eligible for the award, instead of nominated for it.
@ -210,7 +210,7 @@ function getProjectsNominatedForSpecialAward($award_id)
project_specialawards_link.award_awards_id='$award_id' project_specialawards_link.award_awards_id='$award_id'
AND project_specialawards_link.projects_id=projects.id AND project_specialawards_link.projects_id=projects.id
AND projects.projectnumber is not null AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectsort projectsort
"); ");
@ -235,7 +235,7 @@ function getProjectsNominatedForSpecialAward($award_id)
function getSpecialAwardsNominatedByRegistrationID($id) function getSpecialAwardsNominatedByRegistrationID($id)
{ {
global $config; global $conference;
$awardq=mysql_query("SELECT $awardq=mysql_query("SELECT
award_awards.id, award_awards.id,
@ -255,7 +255,7 @@ function getSpecialAwardsNominatedByRegistrationID($id)
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND projects.projectnumber is not null AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
ORDER BY ORDER BY
projectsort projectsort
"); ");
@ -281,7 +281,7 @@ function project_load($pid)
/* Load the students */ /* Load the students */
$q = mysql_query("SELECT students.*,schools.school FROM students $q = mysql_query("SELECT students.*,schools.school FROM students
LEFT JOIN schools ON schools.id=students.schools_id LEFT JOIN schools ON schools.id=students.schools_id
WHERE registrations_id='{$proj['registrations_id']}' AND students.year='{$proj['year']}' ORDER BY students.id"); WHERE registrations_id='{$proj['registrations_id']}' AND students.conferences_id='{$proj['conferences_id']}' ORDER BY students.id");
$proj['num_students'] = 0; $proj['num_students'] = 0;
while($s = mysql_fetch_assoc($q)) { while($s = mysql_fetch_assoc($q)) {
$proj['num_students']++; $proj['num_students']++;

View File

@ -48,7 +48,7 @@ function registrationDeadlinePassed()
function studentStatus($reg_id="") function studentStatus($reg_id="")
{ {
global $config; global $config, $conference;
if($config['participant_student_personal']=="yes") if($config['participant_student_personal']=="yes")
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex"); $required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex");
else else
@ -60,7 +60,7 @@ function studentStatus($reg_id="")
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have the minimum, return incomplete //if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minstudentsperproject']) if(mysql_num_rows($q)<$config['minstudentsperproject'])
@ -89,18 +89,18 @@ function studentStatus($reg_id="")
function emergencycontactStatus($reg_id="") function emergencycontactStatus($reg_id="")
{ {
global $config; global $conference;
$required_fields=array("firstname","lastname","relation","phone1"); $required_fields=array("firstname","lastname","relation","phone1");
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); $sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
$numstudents=mysql_num_rows($sq); $numstudents=mysql_num_rows($sq);
while($sr=mysql_fetch_object($sq)) while($sr=mysql_fetch_object($sq))
{ {
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'"); $q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
@ -119,7 +119,7 @@ function emergencycontactStatus($reg_id="")
function projectStatus($reg_id="") function projectStatus($reg_id="")
{ {
global $config; global $config, $conference;
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok"); $required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok");
if($config['participant_short_title_enable'] == 'yes') if($config['participant_short_title_enable'] == 'yes')
@ -131,7 +131,7 @@ function projectStatus($reg_id="")
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have a project entry yet, return empty //if we dont have a project entry yet, return empty
if(!mysql_num_rows($q)) if(!mysql_num_rows($q))
@ -154,19 +154,19 @@ function projectStatus($reg_id="")
function mentorStatus($reg_id="") function mentorStatus($reg_id="")
{ {
global $config; global $config, $conference;
$required_fields=array("firstname","lastname","phone","email","organization","description"); $required_fields=array("firstname","lastname","phone","email","organization","description");
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
//first check the registrations table to see if 'nummentors' is set, or if its null //first check the registrations table to see if 'nummentors' is set, or if its null
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
if($r->nummentors==null) if($r->nummentors==null)
return "incomplete"; return "incomplete";
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have the minimum, return incomplete //if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minmentorserproject']) if(mysql_num_rows($q)<$config['minmentorserproject'])
@ -190,7 +190,7 @@ function mentorStatus($reg_id="")
function safetyStatus($reg_id="") function safetyStatus($reg_id="")
{ {
global $config; global $conference;
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
@ -203,7 +203,7 @@ function safetyStatus($reg_id="")
} }
//now grab all the questions //now grab all the questions
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord"); $q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
if($r->required=="yes" && !$safetyanswers[$r->id]) if($r->required=="yes" && !$safetyanswers[$r->id])
@ -217,7 +217,7 @@ function safetyStatus($reg_id="")
function spawardStatus($reg_id="") function spawardStatus($reg_id="")
{ {
global $config; global $conference;
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
@ -232,7 +232,7 @@ function spawardStatus($reg_id="")
projects projects
WHERE WHERE
project_specialawards_link.projects_id='".$project->id."' project_specialawards_link.projects_id='".$project->id."'
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
"); ");
if(mysql_num_rows($awardsq)) if(mysql_num_rows($awardsq))
@ -243,20 +243,20 @@ function spawardStatus($reg_id="")
function tourStatus($reg_id="") function tourStatus($reg_id="")
{ {
global $config; global $config, $conference;
if($reg_id) $rid=$reg_id; if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id']; else $rid=$_SESSION['registration_id'];
/* Get the students for this project */ /* Get the students for this project */
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
$num_found = mysql_num_rows($q); $num_found = mysql_num_rows($q);
$ret = "complete"; $ret = "complete";
while($s=mysql_fetch_object($q)) { while($s=mysql_fetch_object($q)) {
//grab all of their tour prefs //grab all of their tour prefs
$sid = $s->id; $sid = $s->id;
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}' ORDER BY rank"); $qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and conferences_id='{$conference['id']}' ORDER BY rank");
$n_tours = mysql_num_rows($qq); $n_tours = mysql_num_rows($qq);
if($n_tours > 0) { if($n_tours > 0) {
@ -281,12 +281,12 @@ function tourStatus($reg_id="")
} }
function namecheckStatus($reg_id="") function namecheckStatus($reg_id="")
{ {
global $config; global $conference;
if($reg_id) { if($reg_id) {
$q=mysql_query("SELECT * FROM students WHERE $q=mysql_query("SELECT * FROM students WHERE
registrations_id='$reg_id' registrations_id='$reg_id'
AND year='".$config['FAIRYEAR']."'"); AND conferences_id='".$conference['id']."'");
} else { } else {
$q=mysql_query("SELECT * FROM students WHERE $q=mysql_query("SELECT * FROM students WHERE
id='{$_SESSION['students_id']}'"); id='{$_SESSION['students_id']}'");
@ -304,7 +304,7 @@ function namecheckStatus($reg_id="")
function generateProjectNumber($registration_id) function generateProjectNumber($registration_id)
{ {
global $config; global $config, $conference;
$reg_id = $registration_id; $reg_id = $registration_id;
@ -320,8 +320,8 @@ function generateProjectNumber($registration_id)
registrations_id='$reg_id' registrations_id='$reg_id'
AND projects.projectdivisions_id=projectdivisions.id AND projects.projectdivisions_id=projectdivisions.id
AND projects.projectcategories_id=projectcategories.id AND projects.projectcategories_id=projectcategories.id
AND projectcategories.year='{$config['FAIRYEAR']}' AND projectcategories.conferences_id='{$conference['id']}'
AND projectdivisions.year='{$config['FAIRYEAR']}' AND projectdivisions.conferences_id='{$conference['id']}'
"); ");
echo mysql_error(); echo mysql_error();
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
@ -357,7 +357,7 @@ function generateProjectNumber($registration_id)
$q = mysql_query("SELECT projectnumber_seq,projectsort_seq, $q = mysql_query("SELECT projectnumber_seq,projectsort_seq,
projectdivisions_id,projectcategories_id projectdivisions_id,projectcategories_id
FROM projects FROM projects
WHERE year='{$config['FAIRYEAR']}' WHERE conferences_id='{$conference['id']}'
AND projectnumber_seq!='0' AND projectnumber_seq!='0'
AND projectnumber IS NOT NULL"); AND projectnumber IS NOT NULL");
echo mysql_error(); echo mysql_error();
@ -430,15 +430,15 @@ function generateProjectNumber($registration_id)
function computeRegistrationFee($regid) function computeRegistrationFee($regid)
{ {
global $config; global $config, $conference;
$ret = array(); $ret = array();
$regfee_items = array(); $regfee_items = array();
$q = mysql_query("SELECT * FROM regfee_items $q = mysql_query("SELECT * FROM regfee_items
WHERE year='{$config['FAIRYEAR']}'"); WHERE conferences_id='{$conference['id']}'");
while($i = mysql_fetch_assoc($q)) $regfee_items[] = $i; while($i = mysql_fetch_assoc($q)) $regfee_items[] = $i;
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
$n_students = mysql_num_rows($q); $n_students = mysql_num_rows($q);
$n_tshirts = 0; $n_tshirts = 0;
$sel = array(); $sel = array();

View File

@ -30,12 +30,12 @@
$datecheck=mysql_fetch_object($q); $datecheck=mysql_fetch_object($q);
if($_POST['action']=="new") { if($_POST['action']=="new") {
$q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND year=".$config['FAIRYEAR']); $q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND conferences_id=".$conference['id']);
if(mysql_num_rows($q)) { if(mysql_num_rows($q)) {
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
$_SESSION['registration_number']=$r->num; $_SESSION['registration_number']=$r->num;
$_SESSION['registration_id']=$r->id; $_SESSION['registration_id']=$r->id;
mysql_query("INSERT INTO students (registrations_id,email,schools_id,year) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$config['FAIRYEAR']."')"); mysql_query("INSERT INTO students (registrations_id,email,schools_id,conferences_id) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$conference['id']."')");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->id'"); mysql_query("UPDATE registrations SET status='open' WHERE id='$r->id'");
header("Location: register_participants_main.php"); header("Location: register_participants_main.php");
@ -57,8 +57,8 @@
"WHERE students.email='".$_SESSION['email']."' ". "WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".intval($_POST['regnum'])."' ". "AND registrations.num='".intval($_POST['regnum'])."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
if(mysql_num_rows($q)) { if(mysql_num_rows($q)) {
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
@ -81,7 +81,7 @@
registrations registrations
WHERE WHERE
registrations.email='".$_SESSION['email']."' registrations.email='".$_SESSION['email']."'
AND registrations.year='".$config['FAIRYEAR']."'"); AND registrations.conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)) if(mysql_num_rows($q))
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
else { else {
@ -93,7 +93,7 @@
WHERE WHERE
students.email='".$_SESSION['email']."' students.email='".$_SESSION['email']."'
AND students.registrations_id=registrations.id AND students.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'"); AND registrations.conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
} }
@ -137,7 +137,7 @@
//first, check if they have any registrations waiting to be opened //first, check if they have any registrations waiting to be opened
$q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>0) { if(mysql_num_rows($q)>0) {
echo i18n("Please enter your <b>registration number</b> that you received in your email, in order to begin your new registration"); echo i18n("Please enter your <b>registration number</b> that you received in your email, in order to begin your new registration");
echo "<input type=\"hidden\" name=\"action\" value=\"new\">"; echo "<input type=\"hidden\" name=\"action\" value=\"new\">";
@ -154,8 +154,8 @@
registrations registrations
WHERE WHERE
students.email='".$_SESSION['email']."' students.email='".$_SESSION['email']."'
AND students.year=".$config['FAIRYEAR']." AND students.conferences_id=".$conference['id']."
AND registrations.year=".$config['FAIRYEAR']." AND registrations.conferences_id=".$conference['id']."
AND AND
( registrations.status='open' ( registrations.status='open'
OR registrations.status='paymentpending' OR registrations.status='paymentpending'
@ -216,7 +216,7 @@
else if($config['participant_registration_type']=="schoolpassword") { else if($config['participant_registration_type']=="schoolpassword") {
$showschoolpasswordform=true; $showschoolpasswordform=true;
if($_POST['schoolpassword'] && $_POST['schoolid']) { if($_POST['schoolpassword'] && $_POST['schoolid']) {
$q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
if($_POST['schoolpassword']==$r->registration_password) { if($_POST['schoolpassword']==$r->registration_password) {
@ -239,7 +239,7 @@
echo "<input type=\"hidden\" name=\"action\" value=\"login\">"; echo "<input type=\"hidden\" name=\"action\" value=\"login\">";
echo i18n("Email Address:")." ".$_SESSION['email']."<br />"; echo i18n("Email Address:")." ".$_SESSION['email']."<br />";
echo i18n("School: "); echo i18n("School: ");
$q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school"); $q=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
echo "<select name=\"schoolid\">"; echo "<select name=\"schoolid\">";
echo "<option value=\"\">".i18n("Choose your school")."</option>\n"; echo "<option value=\"\">".i18n("Choose your school")."</option>\n";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
@ -292,19 +292,19 @@
//random number between //random number between
//100000 and 999999 (six digit integer) //100000 and 999999 (six digit integer)
$regnum=rand(100000,999999); $regnum=rand(100000,999999);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']); $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND conferences_id=".$conference['id']);
}while(mysql_num_rows($q)>0); }while(mysql_num_rows($q)>0);
if(!$schoolidquery) $schoolidquery="null"; if(!$schoolidquery) $schoolidquery="null";
//actually insert it //actually insert it
mysql_query("INSERT INTO registrations (num,email,start,status,schools_id,year) VALUES (". mysql_query("INSERT INTO registrations (num,email,start,status,schools_id,conferences_id) VALUES (".
"'$regnum',". "'$regnum',".
"'".$_SESSION['email']."',". "'".$_SESSION['email']."',".
"NOW(),". "NOW(),".
"'new',". "'new',".
$schoolidquery.",". $schoolidquery.",".
$config['FAIRYEAR']. $conference['id'].
")"); ")");
email_send("new_participant",$_SESSION['email'],array(),array("REGNUM"=>$regnum,"EMAIL"=>$_SESSION['email'])); email_send("new_participant",$_SESSION['email'],array(),array("REGNUM"=>$regnum,"EMAIL"=>$_SESSION['email']));

View File

@ -43,8 +43,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -82,7 +82,7 @@ echo mysql_error();
//first, lets make sure this emergency contact really does belong to them //first, lets make sure this emergency contact really does belong to them
foreach($_POST['ids'] AS $id) foreach($_POST['ids'] AS $id)
{ {
$q=mysql_query("SELECT * FROM emergencycontact WHERE id='$id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM emergencycontact WHERE id='$id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1) { if(mysql_num_rows($q)==1) {
$e=stripslashes($_POST['email'][$id]); $e=stripslashes($_POST['email'][$id]);
if($_POST['relation'][$id]=="Parent" && $e && user_valid_email($e)) { if($_POST['relation'][$id]=="Parent" && $e && user_valid_email($e)) {
@ -141,7 +141,7 @@ else if($newstatus=="complete")
} }
$sq=mysql_query("SELECT id,firstname,lastname FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $sq=mysql_query("SELECT id,firstname,lastname FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$numstudents=mysql_num_rows($sq); $numstudents=mysql_num_rows($sq);
echo "<form name=\"emergencycontactform\" method=\"post\" action=\"register_participants_emergencycontact.php\">\n"; echo "<form name=\"emergencycontactform\" method=\"post\" action=\"register_participants_emergencycontact.php\">\n";
@ -149,10 +149,10 @@ echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
while($sr=mysql_fetch_object($sq)) while($sr=mysql_fetch_object($sq))
{ {
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'"); $q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'");
if(mysql_num_rows($q)==0) { if(mysql_num_rows($q)==0) {
mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,year) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$config['FAIRYEAR']."')"); mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$conference['id']."')");
$id=mysql_insert_id(); $id=mysql_insert_id();
unset($r); unset($r);
} }

View File

@ -41,8 +41,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)

View File

@ -43,8 +43,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -68,7 +68,7 @@ echo mysql_error();
{ {
//now select their project number //now select their project number
$q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
if($r->status=="complete") if($r->status=="complete")
@ -280,7 +280,7 @@ echo "<table><tr><td>";
} }
} }
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='{$conference['id']}'");
$project=mysql_fetch_object($q); $project=mysql_fetch_object($q);
$nominatedawards=getSpecialAwardsNominatedForProject($project->id); $nominatedawards=getSpecialAwardsNominatedForProject($project->id);
$num=count($nominatedawards); $num=count($nominatedawards);

View File

@ -42,8 +42,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -145,11 +145,11 @@ if($_GET['action']=="removementor")
//now query and display //now query and display
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
$registrations_nummentors=$r->nummentors; $registrations_nummentors=$r->nummentors;
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$numfound=mysql_num_rows($q); $numfound=mysql_num_rows($q);

View File

@ -42,8 +42,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -82,7 +82,7 @@ echo mysql_error();
else else
{ {
//first, lets make sure this project really does belong to them //first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1) if(mysql_num_rows($q)==1)
{ {
$summarywords=preg_split("/[\s,]+/",$_POST['summary']); $summarywords=preg_split("/[\s,]+/",$_POST['summary']);
@ -137,7 +137,7 @@ echo mysql_error();
$gradeinfo=mysql_fetch_object($q); $gradeinfo=mysql_fetch_object($q);
//now lets grab all the age categories, so we can choose one based on the max grade //now lets grab all the age categories, so we can choose one based on the max grade
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
//save these in an array, just incase we need them later (FIXME: remove this array if we dont need it) //save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
@ -151,13 +151,13 @@ echo mysql_error();
} }
} }
//now select their project info //now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one //check if it exists, if we didnt find any record, lets insert one
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
{ {
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$config['FAIRYEAR']."')"); mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$conference['id']."')");
//now query the one we just inserted //now query the one we just inserted
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
} }
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
@ -228,11 +228,11 @@ function countwords()
//###### Feature Specific - filtering divisions by category //###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){ if($config['filterdivisionbycategory']=="yes"){
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division"); $q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division");
echo mysql_error(); echo mysql_error();
//### //###
}else }else
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division");
echo "<select name=\"projectdivisions_id\">"; echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n"; echo "<option value=\"\">".i18n("Select a division")."</option>\n";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))

View File

@ -42,8 +42,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)

View File

@ -40,8 +40,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) { if(mysql_num_rows($q)==0) {
@ -65,14 +65,14 @@ echo mysql_error();
} }
else { else {
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them //first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(is_array($_POST['safety'])) { if(is_array($_POST['safety'])) {
$safetyids=array_keys($_POST['safety']); $safetyids=array_keys($_POST['safety']);
foreach($safetyids AS $key=>$val) { foreach($safetyids AS $key=>$val) {
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,year,answer) VALUES (". mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,conferences_id,answer) VALUES (".
"'".$_SESSION['registration_id']."', ". "'".$_SESSION['registration_id']."', ".
"'$val', ". "'$val', ".
"'".$config['FAIRYEAR']."', ". "'".$conference['id']."', ".
"'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')"); "'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')");
echo mysql_error(); echo mysql_error();
} }
@ -94,7 +94,7 @@ else if($newstatus=="complete") {
$safetyanswers[$r->safetyquestions_id]=$r->answer; $safetyanswers[$r->safetyquestions_id]=$r->answer;
} }
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord"); $q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
if(mysql_num_rows($q)) { if(mysql_num_rows($q)) {
echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer"); echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer");
echo "<br />"; echo "<br />";

View File

@ -47,8 +47,8 @@
AND registrations.num='{$_SESSION['registration_number']}' AND registrations.num='{$_SESSION['registration_number']}'
AND registrations.id='{$_SESSION['registration_id']}' AND registrations.id='{$_SESSION['registration_id']}'
AND students.registrations_id=registrations.id AND students.registrations_id=registrations.id
AND registrations.year={$config['FAIRYEAR']} AND registrations.conferences_id={$conference['id']}
AND students.year={$config['FAIRYEAR']}"); AND students.conferences_id={$conference['id']}");
$registration_number=$_SESSION['registration_number']; $registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id']; $registration_id=$_SESSION['registration_id'];
@ -93,13 +93,13 @@ $pdf->AddPage();
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id
JOIN projectcategories ON projects.projectcategories_id=projectcategories.id JOIN projectcategories ON projects.projectcategories_id=projectcategories.id
WHERE registrations_id='".$_SESSION['registration_id']."' WHERE registrations_id='".$_SESSION['registration_id']."'
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.year='".$config['FAIRYEAR']."' AND projectcategories.conferences_id='".$conference['id']."'
"); ");
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($si=mysql_fetch_object($q)) while($si=mysql_fetch_object($q))
$studentinfoarray[]=$si; $studentinfoarray[]=$si;
} }

View File

@ -49,8 +49,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
$registration_number=$_SESSION['registration_number']; $registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id']; $registration_id=$_SESSION['registration_id'];
@ -112,13 +112,13 @@ $pdf->newPage();
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id
JOIN projectcategories ON projects.projectcategories_id=projectcategories.id JOIN projectcategories ON projects.projectcategories_id=projectcategories.id
WHERE registrations_id='".$_SESSION['registration_id']."' WHERE registrations_id='".$_SESSION['registration_id']."'
AND projects.year='".$config['FAIRYEAR']."' AND projects.conferences_id='".$conference['id']."'
AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.year='".$config['FAIRYEAR']."' AND projectcategories.conferences_id='".$conference['id']."'
"); ");
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($si=mysql_fetch_object($q)) while($si=mysql_fetch_object($q))
$studentinfoarray[]=$si; $studentinfoarray[]=$si;
} }

View File

@ -43,8 +43,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -126,15 +126,15 @@ function checkboxclicked(b)
} }
else else
{ {
mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND conferences_id='".$conference['id']."'");
foreach($splist AS $spaward) foreach($splist AS $spaward)
{ {
$s = ($spaward == -1) ? "NULL" : "'$spaward'"; $s = ($spaward == -1) ? "NULL" : "'$spaward'";
mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (". mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,conferences_id) VALUES (".
"$s, ". "$s, ".
"'$project->id', ". "'$project->id', ".
"'".$config['FAIRYEAR']."')"); "'".$conference['id']."')");
echo mysql_error(); echo mysql_error();
} }
if($num) { if($num) {

View File

@ -42,8 +42,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -60,7 +60,7 @@ echo mysql_error();
$regfee_items = array(); $regfee_items = array();
$items_q = mysql_query("SELECT * FROM regfee_items $items_q = mysql_query("SELECT * FROM regfee_items
WHERE year='{$config['FAIRYEAR']}'"); WHERE conferences_id='{$conference['id']}'");
while($items_i = mysql_fetch_assoc($items_q)) { while($items_i = mysql_fetch_assoc($items_q)) {
$regfee_items[] = $items_i; $regfee_items[] = $items_i;
} }
@ -89,7 +89,7 @@ if($_POST['action']=="save")
//if they use schoolpassword or singlepassword, then we need to set the school based on the school stored in the registration record. for anything else they can school the school on their own. //if they use schoolpassword or singlepassword, then we need to set the school based on the school stored in the registration record. for anything else they can school the school on their own.
if($config['participant_registration_type']=="schoolpassword" || $config['participant_registration_type']=="invite") if($config['participant_registration_type']=="schoolpassword" || $config['participant_registration_type']=="invite")
{ {
$q=mysql_query("SELECT schools_id FROM registrations WHERE id='".$_SESSION['registration_id']."' AND YEAR='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT schools_id FROM registrations WHERE id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
$schools_id=$r->schools_id; $schools_id=$r->schools_id;
@ -101,7 +101,7 @@ if($_POST['action']=="save")
} }
//INSERT new record //INSERT new record
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x]; $dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,pronunciation,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,year) VALUES (". mysql_query("INSERT INTO students (registrations_id,firstname,lastname,pronunciation,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,conferences_id) VALUES (".
"'".$_SESSION['registration_id']."', ". "'".$_SESSION['registration_id']."', ".
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
@ -121,7 +121,7 @@ if($_POST['action']=="save")
"'".mysql_escape_string(stripslashes($_POST['foodreq'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['foodreq'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ".
"'".$config['FAIRYEAR']."')"); "'".$conference['id']."')");
$students_id = mysql_insert_id(); $students_id = mysql_insert_id();
echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x]))); echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x])));
@ -199,10 +199,10 @@ if($_GET['action']=="removestudent")
//now see if they have an emergency contact that also needs to be removed //now see if they have an emergency contact that also needs to be removed
$q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
//no need to error message if this doesnt exist //no need to error message if this doesnt exist
if(mysql_num_rows($q)==1) if(mysql_num_rows($q)==1)
mysql_query("DELETE FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM regfee_items_link WHERE students_id='$students_id'"); mysql_query("DELETE FROM regfee_items_link WHERE students_id='$students_id'");
@ -231,14 +231,14 @@ else if($newstatus=="complete")
//now query and display //now query and display
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
{ {
//uhh oh, we didnt find any, this isnt possible! lets insert one using the logged in persons email address //uhh oh, we didnt find any, this isnt possible! lets insert one using the logged in persons email address
//although... this can never really happen, since the above queries only allow the page to view if the student //although... this can never really happen, since the above queries only allow the page to view if the student
//is found in the students table... soo... well, lets leave it here as a fallback anyways, just incase //is found in the students table... soo... well, lets leave it here as a fallback anyways, just incase
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$config['FAIRYEAR']."')"); mysql_query("INSERT INTO students (registrations_id,email,conferences_id) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$conference['id']."')");
//if we just inserted it, then we will obviously find 1 //if we just inserted it, then we will obviously find 1
$numfound=1; $numfound=1;
} }
@ -351,6 +351,7 @@ if($config['participant_student_personal']=="yes")
echo "</td><td>\n"; echo "</td><td>\n";
//the year selector should be based on the min/max ages possible (as set in $config) //the year selector should be based on the min/max ages possible (as set in $config)
// FIXME - this should be converted to use the year in which the conference occurs
$minyearselect = $config['FAIRYEAR'] - $config['maxage']; $minyearselect = $config['FAIRYEAR'] - $config['maxage'];
$maxyearselect = $config['FAIRYEAR'] - $config['minage']; $maxyearselect = $config['FAIRYEAR'] - $config['minage'];
emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect); emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect);
@ -425,7 +426,7 @@ if($config['participant_student_personal']=="yes")
echo " <td>".i18n("School")."</td><td colspan=\"3\">"; echo " <td>".i18n("School")."</td><td colspan=\"3\">";
if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || $config['participant_registration_type']=="openorinvite" || ($studentinfo && !$studentinfo->schools_id) ) if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || $config['participant_registration_type']=="openorinvite" || ($studentinfo && !$studentinfo->schools_id) )
{ {
$schoolq=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER by city,school"); $schoolq=mysql_query("SELECT id,school,city FROM schools WHERE conferences_id='".$conference['id']."' ORDER by city,school");
echo "<select name=\"schools_id[$x]\">\n"; echo "<select name=\"schools_id[$x]\">\n";
echo "<option value=\"\">".i18n("Choose School")."</option>\n"; echo "<option value=\"\">".i18n("Choose School")."</option>\n";
while($r=mysql_fetch_object($schoolq)) while($r=mysql_fetch_object($schoolq))
@ -443,7 +444,7 @@ if($config['participant_student_personal']=="yes")
} }
else else
{ {
$schoolq=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' AND id='$studentinfo->schools_id'"); $schoolq=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' AND id='$studentinfo->schools_id'");
$r=mysql_fetch_object($schoolq); $r=mysql_fetch_object($schoolq);
echo $r->school; echo $r->school;
} }

View File

@ -42,8 +42,8 @@
"AND registrations.num='".$_SESSION['registration_number']."' ". "AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ". "AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ". "AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ". "AND registrations.conferences_id=".$conference['id']." ".
"AND students.year=".$config['FAIRYEAR']); "AND students.conferences_id=".$conference['id']);
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) if(mysql_num_rows($q)==0)
@ -77,7 +77,7 @@ echo mysql_error();
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them //first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
mysql_query("DELETE FROM tours_choice mysql_query("DELETE FROM tours_choice
WHERE registrations_id='{$_SESSION['registration_id']}' WHERE registrations_id='{$_SESSION['registration_id']}'
AND year='{$config['FAIRYEAR']}' AND conferences_id='{$conference['id']}'
AND rank!='0'"); AND rank!='0'");
if(is_array($_POST['toursel'])) if(is_array($_POST['toursel']))
{ {
@ -98,11 +98,11 @@ echo mysql_error();
/* Remember this choice in a format that is easily searchable */ /* Remember this choice in a format that is easily searchable */
$selarray[] = $x; $selarray[] = $x;
mysql_query("INSERT INTO tours_choice (registrations_id,students_id,tour_id,year,rank) VALUES (". mysql_query("INSERT INTO tours_choice (registrations_id,students_id,tour_id,conferences_id,rank) VALUES (".
"'".$_SESSION['registration_id']."', ". "'".$_SESSION['registration_id']."', ".
"'".intval($students_id)."', ". "'".intval($students_id)."', ".
"'".intval($tid)."', ". "'".intval($tid)."', ".
"'".$config['FAIRYEAR']."', ". "'".$conference['id']."', ".
"'$rank')"); "'$rank')");
echo mysql_error(); echo mysql_error();
} }
@ -140,7 +140,7 @@ else if($newstatus=="complete")
$assigned_tour = array(); $assigned_tour = array();
$q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
if($r->rank == 0) $assigned_tour[$r->students_id] = $r->tour_id; if($r->rank == 0) $assigned_tour[$r->students_id] = $r->tour_id;
@ -148,7 +148,7 @@ else if($newstatus=="complete")
} }
$tours = array(); $tours = array();
$q=mysql_query("SELECT * FROM tours WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $q=mysql_query("SELECT * FROM tours WHERE conferences_id='".$conference['id']."' ORDER BY id");
if(mysql_num_rows($q) == 0) if(mysql_num_rows($q) == 0)
{ {
echo notice(i18n("There is not tour information")); echo notice(i18n("There is not tour information"));
@ -173,7 +173,7 @@ else if($newstatus=="complete")
echo "<form method=\"post\" action=\"register_participants_tours.php\">\n"; echo "<form method=\"post\" action=\"register_participants_tours.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$num_found = mysql_num_rows($q); $num_found = mysql_num_rows($q);
$print_submit = false; $print_submit = false;

View File

@ -5,7 +5,7 @@ require_once('user.inc.php');
// authenticate the login // authenticate the login
if($_POST['schoolid'] && $_POST['accesscode']) if($_POST['schoolid'] && $_POST['accesscode'])
{ {
$q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1) if(mysql_num_rows($q)==1)
{ {
$_SESSION['schoolid']=$_POST['schoolid']; $_SESSION['schoolid']=$_POST['schoolid'];
@ -28,7 +28,7 @@ if($_GET['action']=="logout")
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
// we're logged in, draw the dashboard // we're logged in, draw the dashboard
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND conferences_id='".$conference['id']."'");
echo mysql_error(); echo mysql_error();
$school=mysql_fetch_object($q); $school=mysql_fetch_object($q);
if($school) { if($school) {
@ -72,7 +72,7 @@ function draw_dashboard(){
function draw_login(){ function draw_login(){
send_header("School Home"); send_header("School Home");
global $errormsg, $happymsg, $config; global $errormsg, $happymsg, $config, $conference;
if($errormsg) echo "<font color=red><b>$errormsg</b></font>"; if($errormsg) echo "<font color=red><b>$errormsg</b></font>";
if($happymsg) echo happy($happymsg); if($happymsg) echo happy($happymsg);
@ -98,7 +98,7 @@ function draw_login(){
<select name="schoolid"> <select name="schoolid">
<option value=""><?=i18n("Choose your school")?></option> <option value=""><?=i18n("Choose your school")?></option>
<? <?
$q=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school"); $q=mysql_query("SELECT id,school,city FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
$prev="somethingthatdoesnotexist"; $prev="somethingthatdoesnotexist";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {

View File

@ -3,7 +3,7 @@ include "common.inc.php";
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type'] != 'scienceolympics'){ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type'] != 'scienceolympics'){
send_header("School Participant Invitations"); send_header("School Participant Invitations");
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'"); $q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND conferences_id='".$conference['id']."'");
echo mysql_error(); echo mysql_error();
$school=mysql_fetch_object($q); $school=mysql_fetch_object($q);
if($school) if($school)
@ -42,7 +42,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
if($_POST['firstname'] && $_POST['lastname'] && $_POST['email'] && $_POST['grade']) if($_POST['firstname'] && $_POST['lastname'] && $_POST['email'] && $_POST['grade'])
{ {
//make sure they arent already invited! //make sure they arent already invited!
$q=mysql_query("SELECT firstname, lastname FROM students WHERE year='".$config['FAIRYEAR']."' AND email='".$_POST['email']."'"); $q=mysql_query("SELECT firstname, lastname FROM students WHERE conferences_id='".$conference['id']."' AND email='".$_POST['email']."'");
if(mysql_num_rows($q)) if(mysql_num_rows($q))
{ {
echo error(i18n("That students email address has already been invited")); echo error(i18n("That students email address has already been invited"));
@ -56,17 +56,17 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
//random number between //random number between
//100000 and 999999 (six digit integer) //100000 and 999999 (six digit integer)
$regnum=rand(100000,999999); $regnum=rand(100000,999999);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']); $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND conferences_id=".$conference['id']);
}while(mysql_num_rows($q)>0); }while(mysql_num_rows($q)>0);
//actually insert it //actually insert it
mysql_query("INSERT INTO registrations (num,email,emailcontact,start,status,year) VALUES (". mysql_query("INSERT INTO registrations (num,email,emailcontact,start,status,conferences_id) VALUES (".
"'$regnum',". "'$regnum',".
"'".$_POST['email']."',". "'".$_POST['email']."',".
"'".$_POST['emailcontact']."',". "'".$_POST['emailcontact']."',".
"NOW(),". "NOW(),".
"'open',". "'open',".
$config['FAIRYEAR']. $conference['id'].
")"); ")");
$regid=mysql_insert_id(); $regid=mysql_insert_id();
@ -77,7 +77,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
'".mysql_escape_string($_POST['lastname'])."', '".mysql_escape_string($_POST['lastname'])."',
'".mysql_escape_string($_SESSION['schoolid'])."', '".mysql_escape_string($_SESSION['schoolid'])."',
'".mysql_escape_string($_POST['grade'])."', '".mysql_escape_string($_POST['grade'])."',
'".$config['FAIRYEAR']."')"); '".$conference['id']."')");
email_send("new_participant",$_POST['email'],array(),array("REGNUM"=>$regnum, "EMAIL"=>$_POST['email'])); email_send("new_participant",$_POST['email'],array(),array("REGNUM"=>$regnum, "EMAIL"=>$_POST['email']));
if($_POST['emailcontact']) if($_POST['emailcontact'])
@ -92,7 +92,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
if($_GET['action']=="uninvite") if($_GET['action']=="uninvite")
{ {
//first, make sure that this is really their student, and it sfor this year. //first, make sure that this is really their student, and it sfor this year.
$q=mysql_query("SELECT * FROM students WHERE id='".$_GET['uninvite']."' AND year='".$config['FAIRYEAR']."' AND schools_id='".$_SESSION['schoolid']."'"); $q=mysql_query("SELECT * FROM students WHERE id='".$_GET['uninvite']."' AND conferences_id='".$conference['id']."' AND schools_id='".$_SESSION['schoolid']."'");
if(mysql_num_rows($q)) if(mysql_num_rows($q))
{ {
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
@ -126,7 +126,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
registrations registrations
WHERE WHERE
students.schools_id='".$school->id."' students.schools_id='".$school->id."'
AND students.year='".$config['FAIRYEAR']."' AND students.conferences_id='".$conference['id']."'
AND students.registrations_id=registrations.id AND students.registrations_id=registrations.id
ORDER BY ORDER BY
lastname, lastname,
@ -160,7 +160,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
else if($school->projectlimitper=="agecategory") else if($school->projectlimitper=="agecategory")
{ {
echo "<br />"; echo "<br />";
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); $catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($catr=mysql_fetch_object($catq)){ while($catr=mysql_fetch_object($catq)){
$q2=mysql_query("SELECT COUNT(students.id) AS num $q2=mysql_query("SELECT COUNT(students.id) AS num
@ -171,7 +171,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
students.schools_id='".$school->id."' students.schools_id='".$school->id."'
AND students.grade>='$catr->mingrade' AND students.grade>='$catr->mingrade'
AND students.grade<='$catr->maxgrade' AND students.grade<='$catr->maxgrade'
AND students.year='".$config['FAIRYEAR']."' AND students.conferences_id='".$conference['id']."'
AND students.registrations_id=registrations.id AND students.registrations_id=registrations.id
"); ");
echo mysql_error(); echo mysql_error();

View File

@ -129,14 +129,14 @@ function tableEditorSave($data)
function tableEditorDelete() function tableEditorDelete()
{ {
global $config; global $conference;
$id = $this->id; $id = $this->id;
mysql_query("DELETE FROM tours_choice WHERE tour_id='$id' AND year=".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM tours_choice WHERE tour_id='$id' AND conferences_id=".$conference['id']."'");
mysql_query("DELETE FROM tours WHERE id='$id' AND year='".$config['FAIRYEAR']."'"); mysql_query("DELETE FROM tours WHERE id='$id' AND conferences_id='".$conference['id']."'");
echo happy(i18n("Successfully removed tour from this year's fair")); echo happy(i18n("Successfully removed tour from this conference"));
} }
}; };

View File

@ -25,9 +25,9 @@
require_once("common.inc.php"); require_once("common.inc.php");
require_once("user.inc.php"); require_once("user.inc.php");
user_auth_required(); user_auth_required();
echo $config['dates']['fairdate'] . "<hr>";
// find out if this user actually is in this conference // find out if this user actually is in this conference
$query = "SELECT COUNT(*) FROM users WHERE conferences_id = {$_SESSION['conferences_id']}" $query = "SELECT COUNT(*) FROM users WHERE conferences_id = {$conference['id']}"
. " AND accounts_id = " . $_SESSION['accounts_id']; . " AND accounts_id = " . $_SESSION['accounts_id'];
$data = mysql_fetch_array(mysql_query($query)); $data = mysql_fetch_array(mysql_query($query));
if($data[0] == 0){ if($data[0] == 0){

View File

@ -115,10 +115,10 @@
} }
/* See if this email already exists */ /* See if this email already exists */
$q = mysql_query("SELECT id,types,MAX(year) AS year,deleted FROM users WHERE (email='$sql_email' OR username='$sql_email' )"); $q = mysql_query("SELECT id,types,MAX(conferences_id) AS year,deleted FROM users WHERE (email='$sql_email' OR username='$sql_email' )");
//select *, max(year) from users where username=sql_email //select *, max(conferences_id) from users where username=sql_email
//if deleted and year = current yera - just undelete //if deleted and conferences_id = current conference id - just undelete
//if deleted and year != current yera - proceed normally and recreate the user //if deleted and conferences_id != current conference id - proceed normally and recreate the user
if(mysql_num_rows($q) > 0) { if(mysql_num_rows($q) > 0) {
@ -126,7 +126,7 @@
$r = mysql_fetch_object($q); $r = mysql_fetch_object($q);
$types = explode(',', $r->types); $types = explode(',', $r->types);
if($r->year==$config['FAIRYEAR'] && $r->deleted=='yes') { if($r->year==$conference['id'] && $r->deleted=='yes') {
mysql_query("UPDATE users SET deleted='no' WHERE id='$r->id'"); mysql_query("UPDATE users SET deleted='no' WHERE id='$r->id'");
message_push(happy(i18n("Your account has been undeleted"))); message_push(happy(i18n("Your account has been undeleted")));
message_push(notice(i18n("Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password", message_push(notice(i18n("Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password",