%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/alliance/domains/congress-intercultural.eu/public_html/sauv/
Upload File :
Create Path :
Current File : /home/alliance/domains/congress-intercultural.eu/public_html/sauv/a-ajouter_country.php

<?php
include_once("inc/config.php");
include_once("inc/functions.php");
include_once("inc/init.php");
include_once("inc/session.php");

verif_co_admin();

if(isset($_POST['post']) && $_POST['post'] == 1)
{
	$db = new BaseOps;
	$erreur = $db->verif($_POST['name_fr'], "Le titre français");
	if($erreur == "ok") $erreur = $db->verif($_POST['name_en'], "Le titre anglais");
	if($erreur == "ok") $erreur = $db->verif($_POST['code_iso'], "Le code ISO");
	if($erreur == "ok")
	{
		$next_id = $db->next_id("country");
		$values = array(
			"id" => $next_id,
			"couleur" =>  $_POST['couleur'],
			"code_iso" => $_POST['code_iso']);
		$db->insert("country", $values);
		
		//country_fr
		$values = array (
			"country" => $next_id,
			"lang" => 1,
			"name" => $_POST['name_fr']);
		$db->insert("country_lang", $values);
			
		//country_fr
		$values = array (
			"country" => $next_id,
			"lang" => 2,
			"name" => $_POST['name_en']);
		$db->insert("country_lang", $values);
		
		
		
		header("Location:liste_country.php?msg=yes");
	}
	else {
		$err = true;
	}
}

//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>Ajouter un pays - ".$info_titresite."</title>\n";
//affichage du header
include("theme/header_admin.php");
?>

<div class="text_admin">
<h2>Créer un pays</h2>

<?php
if($err) {
	echo "<p class=\"erreurbloc\">".$erreur."</p>";
}
if($yes) {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}
?>
<form action="admin/ajouter_country.php" method="post" class="form">
	<table>
		<tr>
			<td class="label"></td>
			<td class="field head">Français</td>
			<td class="field head">Anglais</td>
		</tr>
		<tr>
			<td class="label">Nom <span class="etoile">*</span></td>
			<td class="field"><input type="text" name="name_fr" value="<?php echo $_POST['name_fr']; ?>" /></td>
			<td class="field"><input type="text" name="name_en" value="<?php echo $_POST['name_en']; ?>" /></td>
		</tr>
		<tr>
			<td class="label">Code iso <span class="etoile">*</span></td>
			<td class="field"><input type="text" name="code_iso" value="<?php echo $_POST['code_iso']; ?>" /></td>
		</tr>
		<tr>
			<td class="label">Couleur <span class="etoile">*</span></td>
			<td class="field"># <input type="text" name="couleur" class="small colorpick" value="<?php echo $_POST['couleur']; ?>" /></td>
			<td class="field"></td>
		</tr>
	</table>
	<div class="form_bouton">
		<input type="hidden" name="post" value="1" />
		<input type="submit" class="bouton" id="maj_bouton" value="Créer un pays" />
	</div>
</form>
</div>

<?

//affichage du footer
include("theme/footer.php");

?>

Zerion Mini Shell 1.0