
<?php

##############################################################################
# registration_form.inc                                                      #
#                                                                            #
# Copyright ViralGames SARL 2000                                             #
##############################################################################

include($BIB."bib_tables.php3");

?>
<link href="extra_links.css" rel="stylesheet">
<script language="Javascript">
<!--
function checkApos(a)
{
	if (a.indexOf("'",0)!=-1) return true;
	return false;
}

function wrongemail(email) { 
	
	if (email == '') return false;
	
	var atpl = email.indexOf("@",0)
		
	if (atpl < 1 ) return true;
	if (atpl == email.length - 1) return true;
	if (email.indexOf(".",atpl) < atpl + 2) return true;
	
	return false;
}

function check(doc_this)
{		
			var error="";

		// on check tous les champs pour voir si le mec n'a pas mis d'apostrophe
		if (checkApos(doc_this.NickName.value))
			error +=  "<?php echo C_ERREURAPOS?>\n";

		if (doc_this.Email)
		{
			if (checkApos(doc_this.Email.value))
				error +=  "<?php echo C_ERREURAPOS3?>\n";
		}
		
		if (doc_this.Password.value==doc_this.NickName.value)
			error +=  "<?php echo C_ERREURPSEUDOPASS?>\n";
			
		if (checkApos(doc_this.Password.value))
			error +=  "<?php echo C_ERREURAPOS2?>\n";

		if (checkApos(doc_this.Password2.value))
			error +=  "<?php echo C_ERREURAPOS2?>\n";

		//checks if the player accepts or not the rules. If not it will be redirected

		if (doc_this.NickName.value.length == 0)
			error =  "<?php echo C_ERREURPSEUDO?>\n";
<?php 
if (empty($guest))
{
?>
		if (wrongemail(doc_this.Email.value))
			error = error + "<?php echo C_ERREURMAIL?>\n";
<?php
}
?>
		if (doc_this.Password.value.length < 4)
			error = error + "<?php echo C_PWDTROPCOURT?>\n";

		if (doc_this.Password.value != doc_this.Password2.value)
			{
			error = error + "<?php echo C_ERREURPWDCONF?>\n";
			doc_this.Password.value = "";
			doc_this.Password2.value = "";
			}

		if (doc_this.Zip.value.length < 5)
			error = error + "<?php echo C_ERREURCPOSTAL?>\n";
		else
			{
			if (isNaN(doc_this.Zip.value))
				error = error + "<?php echo C_ERREURCPOSTAL?>\n";
			}
			
		if (doc_this.Name.value=='')
			error = error + "<?php echo C_ERREURNOM?>\n";
		
		if (doc_this.FirstName.value=='')
			error = error + "<?php echo C_ERREURPRENOM?>\n";
			
		if (doc_this.Address.value=='')
			error = error + "<?php echo C_ERREURADR?>\n";

		if (doc_this.Town.value=='')
			error = error + "<?php echo C_ERREURVILLE?>\n";

		if (doc_this.Country.value=='')
			error = error + "<?php echo C_ERREURPAYS?>\n";



		if (error != '')
			{
			
			alert(error);
			return false;
			}
		else
			{
			return true;
			}
	}
//-->
</script>

<?php
function optionRadio($opt,$value)
{
	if (intval($opt) == $value)
		return " checked ";
}

function optionChecked($opt)
{
	if ($opt==1)
		return " checked ";
}

function optionSelect($opt,$lib)
{
	$selected = "";
	if ($opt == 0)
		$selected = "selected";
	
	return "<option value=0 ".$selected.">$lib</option>";
}


function optionLg($lg, $targetlg)
{
	if ($lg==$targetlg)
		return " checked ";
}


?>


<table id="register_main" cellpadding=0 cellspacing=0 >
	<tr>
		<td id="register_maingauche">
<?php table_ktf_up( 'Pronostics gratuits', '300px','black', 1, '14px', '#f2c000'  ); ?>
		<div><?php $type_affpronos=3;	$width_prono = 290;	include ($AFFICHE_PARIS_PAGE)?></div>
<?php table_ktf_down( '', 1 ); ?>
			<br>
			<a href="<?php echo $sess->link3($GIFTS_PAGE,""); ?>" title="Cadeaux"><img src="<?php echo $IMAGES_DIR;?>home_image1.jpg" title="Gagnez de nombreux cadeaux" alt="Gagnez de nombreux cadeaux"></a>
			<br><br>
			<?php include($ARCHIVES_DIR."tag_autopromo_300x250.html"); ?>
		</td>
		<td id="register_maindroit" >


<?php 
if (!empty($guest))
{ 
	echo "<div align=left class=smallBoldBlue>&nbsp;&nbsp;Vous avez été parrainné par <b>".$fatherplayer['NickName']."</b>";
	
	# si c'est une adresse email on l'écrit (cas de lycos ou le parrain n'a pas d'email)
	if (strrpos($fathermember[Email], "@"))
		echo " (".$fathermember[Email].")";
	echo ".</div><br>";
}
if ($error != "")
	echo "<div align=center class=smallboldRed>".$error."</div>";

if ($sess->memberid == -1)
{
?>
<table cellpadding=0 cellspacing=0 border=0>
	<tr>
		<td>		
<?php table_ktf_up( '<h1 class="h1table">Inscrivez-vous pour faire vos pronostics !</h1>', '380px','white', 1, '14px', '#165d2f'  ); ?>
	<div class="smallDark" style="text-align:justify;padding:2px 6px;"><?php echo C_REGISTERINTRO; ?></div>
<?php table_ktf_down( 'white', 1 ); ?>
		</td>
		<td valign=bottom>
<?php table_ktf_up( '<h1 class="h1table">Déjà inscrit ?</h1>', '250px','green', 1, '14px', '#f2c000'  ); ?>
	<div class="smallBoldDark" style="text-align:left;padding:2px;"><?php include($GAME_DIR."login_box2.inc"); ?></div>
<?php table_ktf_down( 'green', 1 ); ?>
		</td>
	</tr>
</table>
<br>
<?php
}

	include("registration_form_header.inc");
?>
<?php table_register_up( 'Vos identifiants',1 ); ?>
<table width=100% cellpadding=5 cellspacing=0 border=0>
	<tr class="smallBoldDark"> 
		<td class="smallBoldDark" width=45%>
			<?php echo C_PSEUDO?> *
			<br>
			<input tabindex=1 <?php echo (($onceMId) ? "disable readonly class=inputOff" : "class=inputReg"); ?> type="text" name="NickName" size="30" maxlength="12" value="<?php echo "$NickName"?>">
			</td>
		<td class="smallBoldDark">
			<?php echo C_ADRMAIL?> *
			<br>
			<input tabindex=2 class=inputReg type="text" name="Email" size="30" maxlength=50 value="<?php echo (!empty($guest))?$guest[Email]:$Email; ?>">
		</td>
	</tr>
	<tr class="smallBoldDark"> 
		<td class="smallBoldDark">
	    	<?php echo ($onceMId)?C_PWD2:C_PWD; ?> *
			<br>
	        <input tabindex=3 class=inputReg type="password" name="Password<?php echo ($onceMId)?"1":""; ?>" maxlength="10" size="30" value="<?php echo ($onceMId)?$Password1:$Password ?>">
		</td>
	    <td class="smallBoldDark">
	    	<?php echo C_CONFIRMPWD?> *
	    	<br>
	    	<input tabindex=4  class=inputReg type="password" name="Password2" size="30" maxlength="10" value="<?php echo $Password2 ?>">
		</td>
	</tr>
</table>

<?php table_register_down( 1 ); ?>

<br>

<?php table_register_up( 'Vos coordonnées',1 ); ?>

<table class=smallDark width=100% cellpadding=5 cellspacing=0>
<tr>
	<td class="smallBoldDark" width=45%>
		<input tabindex=5 type="radio" name="Gender" value="M" <?php if ($Gender == 'M') echo "checked"?>>
		<?php echo C_HOMME?> 
		<input tabindex=6 type="radio" name="Gender" value="F" <?php if ($Gender == 'F') echo "checked"?>>
		<?php echo C_FEMME?>
	</td>
	<td class=smallBoldDark>
	</td>
</tr>
<tr>
	<td class="smallBoldDark">
		<span class=smallBoldDark><?php echo C_NOM?> :</span> *<br>
		<input class=inputReg tabindex=7 type=text name=Name size="30" maxlength="30" value="<?php echo $Name ?>">	
	</td>
	<td class="smallBoldDark">
		<span class=smallBoldDark>Prénom :</span> *<br>
		<input class=inputReg tabindex=8 type=text name=FirstName size="30" maxlength="30" value="<?php echo $FirstName ?>">	
	</td>	
</tr>
<tr>
	<td class="smallBoldDark">
		<span class=smallBoldDark><?php echo C_ADRESSE?> :</span> *<br>
		<input class=inputReg tabindex=9 type=text name=Address size="30" maxlength="50" value="<?php echo $Address ?>">	
	</td>
	<td class="smallBoldDark">
		<span class=smallBoldDark><?php echo C_CODEPOSTAL?> :</span> *<br>
		<input class=inputReg tabindex=10 type=text name=Zip size="30" maxlength="5" value="<?php echo $Zip ?>">	
	</td>
</tr>
<tr>
	<td class="smallBoldDark">
		<span class=smallBoldDark><?php echo C_VILLE?> :</span> *<br>
		<input class=inputReg tabindex=11 type=text name=Town size="30" maxlength="30" value="<?php echo $Town ?>">	
	</td>	
	<td class="smallBoldDark">
		<span class=smallBoldDark><?php echo C_PAYS?> :</span> *<br>
		<select class=inputReg tabindex=12 name='Country' >
		<?php
		if(!$Country)
			$Country = "FR";
		echo DisplayCountryOption($Country);
		?>
		</select>
		
	</td>
</tr>
<tr>
	<td class="smallBoldDark">
		
		<span class=smallBoldDark><?php echo C_DATENAISSANCE; ?> *</span><br>
		<select class=inputReg tabindex=14 maxlength=2 name=jj >
			<?php 
			for($i=1;$i<=31;$i++) 
				echo "\t\t\t<option value=$i".( ($i==$jj)?" selected":"").">$i</option>\n"; 
			?>
			<option value=""<?php echo ( empty($jj) )?" selected":""; ?>>Jour</option>
		</select>
		&nbsp;&nbsp;
		<select class=inputReg tabindex=15 maxlength=2 name=mm >
			<?php 
			for($i=1;$i<=12;$i++) 
				echo "\t\t\t<option value=$i".( ($i==$mm)?" selected":"").">$i</option>\n"; 
			?>
			<option value=""<?php echo ( empty($mm) )?" selected":""; ?>>Mois</option>
		</select>
		&nbsp;&nbsp;
		<input class=inputReg type=text tabindex=16 size=5 maxlength=4 name=yyyy value="<?php echo $yyyy ?>">
	</td>
	<td class="smallBoldDark">
		<!--
		<span class=smallBoldDark><?php echo C_TELEPHONE?> :</span><br>
		<input class=inputReg tabindex=13 type=text name=Telephone size="30" maxlength="10" value="<?php echo $Telephone ?>">
		-->	
	</td>	
</tr>
</table>
<?php table_register_down( 1 ); ?>

<br>

<?php
if( $REGISTRATION_ROBOT == true && !$onceMId)
{
?>
&nbsp; &nbsp; &nbsp; <span class=smallBoldDark>Entrez exactement le code que vous voyez sur l'image *</span>
<table class=smallDark width=100% cellpadding=5 cellspacing=0 style="margin:0px 10px;">
	<tr>
		<td width=45% class=smallBoldDark align=center>
			<img src="im_conf.php3?t=<?php echo $rand; ?>">
		</td>
		<td class=smallBoldDark style="padding-left:8px;">
			<input tabindex=18 class=inputReg type="text" name="conf_code" size="30" maxlength=255 >
			<input type="hidden" name="conf_hash"  value="<?php echo $rand; ?>">
		</td>
	</tr>
</table>
<br>
<?php
}
?>

<!-- partie "j'accepte le règlement" début -->	 
<table width=100%>
<tr>
	<td class=smallDark>
<?php  
	if(!$onceMId)
	{
?>	
		<input tabindex=61 type=hidden name=acceptNews value=1 />
<?php  
	}
	else
	{
?>	
		<input tabindex=61 type=checkbox name=acceptNews value=1 <?php echo (($acceptNews == 1) ? "checked" : ""); ?>>
		J'accepte de recevoir la newsletter d'informations du KestuFoot
<?php  
	}
?>		
		<br>
		<input tabindex=62 type=checkbox name=acceptPartenaires value=1 <?php echo (($acceptPartenaires == 1) ? "checked" : ""); ?>>
		J'accepte de recevoir des informations des partenaires du KestuFoot
		<br>
<?php  
	if(!$onceMId)
	{
?>		<input tabindex=63 type=hidden name=Accepte value=1 />
		
<?php  
	}
?>	
	<br>
		
	</td>
</tr>
</table>

<table width=90%>
<tr>
	<td align=center colspan=2>
		<input tabindex=71 type="image" name="Valider" src="<?php echo $IMAGES_DIR ?>boutons/<?php  echo(!$onceMId)?"btn_inscription.gif":"btn_modifier.gif"
?>" border="0" alt="Valider">
	</td>
</tr>
<tr>
	<td class=smallDark>
		<br>
		* Les champs avec un astérisque(*) sont obligatoires pour valider votre participation. 
	</td>
</tr>
</table>
<!-- partie "j'accepte le règlement" fin -->	 


<br>
<div class=verySmallGray><?php echo C_LOIINFO?><a class=verySmallGrayLink href="<?php echo $sess->link3($CONTACT_PAGE, "sujet_id=2"); ?>">notre service client</a>.
Ce site est inscrit à la CNIL sous le n°725503.
</div>
<input type=hidden name=oncemid value="<?php echo $oncemid ?>">
<input type=hidden name=plog value="<?php echo $plog ?>">
<input type=hidden name=id value="<?php echo $id ?>">

		</td>
	</tr>
</table>
