Files
keliopanel-v1/0.9.0/panel/system/librairie/email/ajoutalias.php
2016-02-21 01:33:05 +01:00

112 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 alias
if ( VerifPOST("Nom", "#^[a-z0-9._-]+@[a-z0-9._-]{2,25}\.[a-z]{2,4}$#", 7, 60) == "ChaineValide" )
{
if ( VerifPOST("Pointage", "#^[a-z0-9._-]+@[a-z0-9._-]{2,15}\.[a-z]{2,4}$#", 7, 60) == "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);
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")) )
{
$CountAlias = $MySql->Count('id', 'email', "Utilisateur = '{$_SESSION['Utilisateur']}' AND Type = 'alias'");
if ( ($CountAlias < $_SESSION['Offre']['AliasEmail']) or ($_SESSION['Offre']['AliasEmail'] == '-1') ) {
$Conteneur = "Utilisateur, Nom, Type, Pointage, Status, Commentaire, DateDeCreation";
$Contenu = "'".$_SESSION['Utilisateur']."', '".$_POST['Nom']."', 'alias', '".$_POST['Pointage']."', '1', '".$_POST['Commentaire']."', '".time()."'";
$MySql->Insert ($Conteneur, $Contenu, "email");
Redirect ('Page-Email-Recapitulatif.html');
} else {
$_SESSION['Resultat'] = "Désolé, votre offre ne vous permet pas d'ajouter plus d'alias.";
$_SESSION['Lien'] = "Page-Email-Suppression.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "Le MX prioritaire ne pointe pas vers mail.kelio.org.<br />Il pointe actuellement vers ".current(array_keys($ServeurMail));
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "Ce domaine n'a aucune redirection MX.";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "Cet email existe deja.";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "Vous ne pouvez pas utiliser le domaine kelio.org";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "Le commentaire est incorrect";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "L'email de pointage de passe est incorrect";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
}
else
{
$_SESSION['Resultat'] = "L'email est incorrect";
$_SESSION['Lien'] = "Page-Email-AjoutAlias.html";
Redirect ('resultat.html');
}
?>