1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
$template->set_filenames(array(
'inscr' => 'inscr.html')
);
if($_POST['username'] != NULL && $_POST['password'] != NULL && $_POST['nom'] != NULL && $_POST['prenom'] != NULL && $_POST['annee_age'] != NULL && is_numeric($_POST['annee_age']) && $_POST['adresse'] != NULL && $_POST['ville'] != NULL && $_POST['province'] != NULL && $_POST['email'] != NULL && ereg('^.+@.+\\..+$', $_POST['email']) && $_POST['ecole'] != NULL && $_POST['annee_ecole'] != NULL){
$sql = "SELECT Username FROM icb_users WHERE Username='".$_POST['username']."'";
if( !($result = $db->sql_query($sql)) )
{
$password = md5($_POST['password']);
$date_xxhhxx = "$jour/$mois/$annee";
$sql = "INSERT INTO `icb_users` (`ID`, `Username`, `Password`, `Nom`, `Prenom`, `Annee_age`, `Adresse`, `Ville`, `Province`, `TelFix`, `TelGSM`, `Email`, `Level`, `Date`, `Ecole`, `Annee_ecole`, `Act`) VALUES (NULL, '".$_POST['username']."', '".$password."', '".$_POST['nom']."', '".$_POST['prenom']."', '".$_POST['annee_age']."', '".$_POST['adresse']."', '".$_POST['ville']."', '".$_POST['province']."', '".$_POST['telfix']."', '".$_POST['telgsm']."', '".$_POST['email']."', '0', '".$date_xxhhxx."', '".$_POST['ecole']."', '".$_POST['annee_ecole']."', '0')";
@mysql_query($sql);
$template->assign_vars(array(
'MARK' => "<!--",
'MESS' => "Inscription terminée ! Votre compte sera activé par l'administration le plus vite possible.",
'MARK_' => "-->"));
}
else{
$template->assign_vars(array(
'MESS' => "Le pseudonyme que vous avez choisi existe déja !"));
}
}
else{
$template->assign_vars(array(
'MESS' => "Formulaire erroné !"));
}
$template->pparse('inscr'); |
Partager