114 lines
3.9 KiB
PHP
Executable File
114 lines
3.9 KiB
PHP
Executable File
<?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.
|
||
*/
|
||
// Librairie d'ajout d'un compte email
|
||
|
||
if ( VerifPOST("Nom", "#^[a-z0-9._-]+@[a-z0-9._-]{2,25}\.[a-z]{2,4}$#", 7, 60) == "ChaineValide" )
|
||
{
|
||
if ( VerifPOST("MotDePasse", "#^[a-z0-9]+$#", 3, 9) == "ChaineValide" )
|
||
{
|
||
if ( ( VerifPOST("Commentaire", "#^[a-z0-9 ]+$#i", 0, 50) == "ChaineValide") or ( VerifPOST("Commentaire", "#^[a-z0-9]+$#i", 0, 50) == "ChaineVide"))
|
||
{
|
||
if ( VerifPOST("Nom", "#@kelio\.org#i", 0, 0) != "ChaineValide" )
|
||
{
|
||
$VerifExistente = $MySql->Select ("*", "email", "Nom='".$_POST['Nom']."'", "", "", "", "");
|
||
if ( $VerifExistente == FALSE )
|
||
{
|
||
$Email = explode ('@', $_POST['Nom']);
|
||
$Domaine = $Email[1];
|
||
$Login = $Email[0];
|
||
$VerifMX = getmxrr($Domaine, $Mxhost, $MxWeight);
|
||
|
||
$ServeurMail = array();
|
||
if ( $VerifMX != FALSE )
|
||
{
|
||
$i=0;
|
||
foreach ($Mxhost as $key => $value)
|
||
{
|
||
$ServeurMail[$value] = $MxWeight[$i];
|
||
$i++;
|
||
}
|
||
asort($ServeurMail);
|
||
|
||
if ( (current(array_keys($ServeurMail)) == "mail.kelio.org") or (gethostbyname(current(array_keys($ServeurMail))) == gethostbyname("mail.kelio.org")) )
|
||
{
|
||
$CountMailbox = $MySql->Count('id', 'email', "Utilisateur = '{$_SESSION['Utilisateur']}' AND Type = 'compte'");
|
||
if ( ($CountMailbox < $_SESSION['Offre']['CompteEmail']) or ($_SESSION['Offre']['CompteEmail'] == '-1')) {
|
||
$Conteneur = "Utilisateur, Nom, Type, Password, Status, Commentaire, DateDeCreation";
|
||
$Contenu = "'".$_SESSION['Utilisateur']."', '".$_POST['Nom']."', 'compte', '".$_POST['MotDePasse']."', '1', '".$_POST['Commentaire']."', '".time()."'";
|
||
$MySql->Insert ($Conteneur, $Contenu, "email");
|
||
Redirect ('Page-Email-Recapitulatif.html');
|
||
} else {
|
||
$_SESSION['Resultat'] = "D<EFBFBD>sol<EFBFBD>, votre offre ne vous permet pas d'ajouter plus de compte.";
|
||
$_SESSION['Lien'] = "Page-Email-Suppression.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Le MX prioritaire ne pointe pas vers l'ip de mail.kelio.org.";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Ce domaine n'a aucune redirection MX.";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Cet email existe deja.";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Vous ne pouvez pas utiliser le domaine kelio.org";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Le commentaire est incorrect";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "Le mot de passe est incorrect";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$_SESSION['Resultat'] = "L'email est incorrect";
|
||
$_SESSION['Lien'] = "Page-Email-AjoutCompte.html";
|
||
Redirect ('resultat.html');
|
||
}
|
||
|
||
|
||
?>
|