Просмотр файла phpmytourney/signup.php

Размер файла: 3.01Kb
<?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);
	$tou_type = get_tourney_type($tourney_id);
	if($status != 1 && $status != 2 && $status != 3) print_error("Can't signup now");
	else if ($status == 3) print_error("No sign up required for this type of tourney,  
					    contestants will be pick according the mix rankings of 
					    the league.  So, grab the top spots to ensure you a place in tourney.
					    <br><br>The check-in works as usual, just show up at tourney time in channel clan [fw]"); 
	else{
	if (!isset($action)){
?>
	<p>
	
	</p>
<?php
	echo("<p>The first time you sign up to a tournament you have to create a login.</p>");
	if ($tou_type == "team")
		echo("<p>Team tourneys : Make sure your allies have an active login !");
	
	print_signup_form($tou_type);	
	}
	else
		$action();
	}
		do_not_remove_please();

	include($footer_file);
	
}
//This prints the sign up form
function print_signup_form($tou_type){
	global $tourney_id;
	
	print_top_form("Sign up Tourney");
	print_textbox("Nickname","name");
	print_password("Password","passwd");
	if($tou_type == "team") print_textbox("Team name","teamname");
	echo("<input type=\"HIDDEN\" name=\"tourney_id\" value=\"" . $tourney_id . "\">");
	echo("<input type=\"HIDDEN\" name=\"action\" value=\"signup\">");
	print_submit("Sign up");
}
function signup(){
	global $name,$passwd,$teamname;
	global $tourney_id;
	
	$tou_type = get_tourney_type($tourney_id);
	$signup_fct = "signup_" . $tou_type;
	if ($tou_type == "team")
		$check_if_signed_up = "is_signed_up";
	else{
		$check_if_signed_up = "main_signup";
		$teamname="";
	}
	
	
	if ($id = login_name($name,$passwd)){	
		if(!($check_if_signed_up($id))){
			if(signup_sql($id,$teamname)){
				if($tou_type == "team"){
					if(insert_in_team_members($id)){
						echo("<br>You are succesfully signed up to this team tourney ...");
						echo("<br>Please pick your pard(s) asap.<a href=\"tourney_team_editor.php?tourney_id=" . $tourney_id . "&name=". $name . "&passwd=" . $passwd ."&action=print_editteam_form2\"> click here </a>. ");	
					}
				}
					echo("<br>You are Successfully signed up to the tourney ... ");			
			}
		}
		else
			print_error("You are allready signed up to tourney");
	}
	else
		print_signup_form($tou_type);
}

?>