<?php
/***********************************************************
* This file was created by Jйrфme Poulin under the phpmytourney
* project.
* You can modify and redistribute this file as long as this
* copyright notice stays in the file.
*
* If you want to do major upgrades on my script, please contact
* me and we could work together.
*
* Jйrфme Poulin
* Student University of Sherbrooke
* [email protected] <== dont use for support !!!
* http:/phpmytourney.sourceforge.net/ <== use sourceforce forum for support
*
* phpMyTourney <C> 2001-2002
************************************************************/
if(!isset($tourney_id)) echo("ERROR : page not properly called");
else{
include('config.inc');
include($header_file);
$status = get_status($tourney_id);
if($status > 7) print_error("Can't modify team once tourney started, sorry...");
else{
if (!isset($action)){
?>
<p>
</p>
<?php
print_editteam_form1();
}
else
$action();
}
do_not_remove_please();
include($footer_file);
}
//This prints the sign up form
function print_editteam_form1(){
global $tourney_id;
echo("<br>Only the team Creator can login here and edit team members");
print_top_form("Edit Tourney Team Login");
print_textbox("Nickname","name");
print_password("Password","passwd");
echo("<input type=\"HIDDEN\" name=\"tourney_id\" value=\"" . $tourney_id . "\">");
echo("<input type=\"HIDDEN\" name=\"action\" value=\"print_editteam_form2\">");
print_submit("Login");
}
function print_editteam_form2(){
global $name,$passwd;
global $tourney_id;
if ($pid = login_name($name,$passwd)){
if (get_ordre($pid)){
$tid = get_players_team($pid);
$nb_per_team = get_nb_per_team($tourney_id);
print_top_form("Pick Pard(s)");
for($i=2;$i<=$nb_per_team;$i++){
$question = "Pick tourney team member" . $i . "<br>don't pick anyone to keep allready selected pard";
print_select_team_members($tid,$pid,$question,"ally_pid[$i]");
}
echo("<input type=\"HIDDEN\" name=\"pid\" value=\"" . $pid . "\">");
echo("<input type=\"HIDDEN\" name=\"tourney_id\" value=\"" . $tourney_id . "\">");
echo("<input type=\"HIDDEN\" name=\"action\" value=\"select_pards\">");
print_submit("Submit Ally");
}
else{
print_error("You sure you created a team in this tourney?");
print_editteam_form1();
}
}
else
print_editteam_form1();
}
function select_pards(){
global $ally_pid,$pid,$tourney_id;
$nb_per_team = get_nb_per_team($tourney_id);
for($i=2;$i<=$nb_per_team;$i++)
if ($ally_pid[$i] > 0)
$sql[] = "UPDATE tourney_team_members_" . $tourney_id . " SET pid='$ally_pid[$i]' where id='$pid' and nb='$i'";
if(execute_queries($sql))
echo("PARDS UPDATED!");
else
print_error("An error occured when updating your allies");
}
function print_select_team_members($tid,$pid,$question,$name){
global $tourney_id;
$sql = "select a.id, a.name
from ALLTOURNEY_players a
LEFT JOIN tourney_team_members_" . $tourney_id . " tm ON a.id=tm.pid
where tm.pid is NULL";
print_select($question,$name,$sql);
}
?>