<?php
/*
Copyright (C) 2007 Mercier Benjamin

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
*/
$CountDNS = $MySql->Count('id', 'sousdomainedns', "Utilisateur='{$_SESSION['Utilisateur']}'");

$ListDomaines = $MySql->Select ('*', 'domainedns', "Utilisateur='{$_SESSION['Utilisateur']}' AND Status!='".KELIO_DELETE."'", '', '', '', '');
$CountDomaines = count ($ListDomaines);
if ( $ListDomaines == FALSE ) { $CountDomaines = 0; }
?>

<h3>Ajouter un sous domaine</h3>

<p class="notice">
	<b>TODO</b> Rédiger la description de cette page
<?php echo $CountDNS."/".$_SESSION['Offre']['SousDomaineDns']; ?>
</p>

<?php
if($CountDNS > 0)
{
	if (($CountDNS < $_SESSION['Offre']['SousDomaineDns']) or ($_SESSION['Offre']['SousDomaineDns'] == '-1')) { ?>
		<div>
			<form action="execution-13.html" method="post">
				<table cellpadding="5">
					<tr>
						<th>Sous-Domaine</th>
						<td>
							<input name="Donnee" type="text" maxlength="80" />
							<b>.</b>
							<select name="Domaine">
								<?php
								for($i = 0; $i < $CountDomaines; $i++)
									echo "<option>{$ListDomaines[$i]["Domaine"]}</option>";
								?>
							</select>
						</td>
					</tr>
					<tr>
						<th>Type </th>
						<td>
							<input name="Type" type="radio" value="1" checked="checked" onclick="Montre_Form('JS_Racine'); Montre_Form('JS_OpenBasedir'); Cache_Form('JS_TypePointage'); Cache_Form('JS_Pointage');"> Ajouter sur les serveurs Kelio<br/>
							<input name="Type" type="radio" value="2" onclick="Cache_Form('JS_Racine'); Cache_Form('JS_OpenBasedir'); Montre_Form('JS_TypePointage'); Montre_Form('JS_Pointage');"> Faire pointer sur un serveur externe
						</td>
					</tr>
					<tr id="JS_Racine">
						<th>Racine</th>
						<td><input name="Racine" type="text" maxlength="80" /></td>
					</tr>
					<tr id="JS_OpenBasedir">
						<th>Open Basedir</th>
						<td><input name="OpenBasedir" type="text" maxlength="80" /></td>
					</tr>
					<tr style="display: none" id="JS_TypePointage">
						<th>Pointage </th>
						<td>
							<select name="TypePointage">
								<option value="2">CNAME (alias)</option>
								<option value="3">A (IPv4)</option>
								<?php /*<option value="4">AAAA (IPv6)</option>*/ ?>
							</select>
						</td>
					</tr>
					<tr style="display: none" id="JS_Pointage">
						<th>Destination </th>
						<td><input name="Pointage" type="text" maxlength="70" /></td>
					</tr>
					<tr>
						<th>Commentaire </th>
						<td><input name="Commentaire" type="text" maxlength="70" /></td>
					</tr>
				</table>
				<input type="submit" name="Submit" value="Ajouter la zone DNS" />
			</form>
		</div>
	<?php } else { ?>
		<p>
			Désolé, votre offre ne vous permet pas d'ajouter plus de sous domaines.
		</p>
	<?php }
}
else { ?>
	<p>
		<b>Avant d'ajouter votre sous domaine, vous devez avoir préalablement <a href="Page-DNS-AjoutDomaine.html">ajouté un nom de domaine sur nos serveur.<a></b><br />
	</p>
<?php } ?>
