/** ADU Postgres OK */
function envoyerMailMotDePasse($req,$objetMail,$message,$codeUtilisateur,$destinataire)
{
global $M_host;
global $M_smtpAuth;
global $M_username;
global $M_password;
global $M_wordWrap;
global $M_port;
global $M_smtpsecure;
global $SERVEURWEB;
global $EMETTEUR;
$emetteur = $EMETTEUR;
$courriel = new PHPMailer();
$courriel->CharSet = 'UTF-8';
$courriel->IsSMTP();
$courriel->Host = $M_host;
$courriel->SMTPAuth = $M_smtpAuth;
$courriel->Username = $M_username;
$courriel->Password = $M_password;
$courriel->WordWrap = $M_wordWrap;
if($M_smtpsecure!="")
$courriel->SMTPSecure = $M_smtpsecure;
$courriel->Port = $M_port;
$courriel->IsHTML(true);
$courriel->AltBody = $message;
$monTexte = "
";
$monTexte.= "";
$monTexte.= "| ".formatHtml2($message)." |
";
$monTexte.= "
";
$courriel->Body = $monTexte;
if($objetMail!="")
$courriel->Subject = $objetMail;
else
$courriel->Subject = "Infos";
/*on recupere les coordonnées de l'envoyeur*/
$courriel->From = $emetteur;
$courriel->FromName = "";
$courriel->AddReplyTo($emetteur, "");
$courriel->AddAddress($destinataire, "");
//envoi du message
if(!$courriel->Send())
{
$messageRetour = "Message could not be sent.
";
$messageRetour.= "Mailer Error: " . $courriel->ErrorInfo."";
}
else
{
$messageRetour="Message envoyé";
}
return $messageRetour;
}
function envoyerMailSuiteMessage($req,$objetMail,$message,$codeUtilisateur,$codeDestinataire)
{
global $M_host;
global $M_smtpAuth;
global $M_username;
global $M_password;
global $M_wordWrap;
global $M_port;
global $M_smtpsecure;
global $SERVEURWEB;
global $EMETTEUR;
global $DB_schema;
$emetteur = $EMETTEUR;
$courriel = new PHPMailer();
$courriel->CharSet = 'UTF-8';
$courriel->IsSMTP();
$courriel->Host = $M_host;
$courriel->SMTPAuth = $M_smtpAuth;
$courriel->Username = $M_username;
$courriel->Password = $M_password;
$courriel->WordWrap = $M_wordWrap;
if($M_smtpsecure!="")
$courriel->SMTPSecure = $M_smtpsecure;
$courriel->Port = $M_port;
$courriel->IsHTML(true);
// recuperation des elements de l'emetteur
$sql = "SELECT nom, prenom, email FROM ".$DB_schema."t_utilisateur WHERE codeutilisateur='$codeUtilisateur'";
$res=$req->execute ($sql);
while($enreg = $req->tableauAssociatif ($res))
{
$nomEmetteur=encoderEnHtml($enreg["nom"]." ".$enreg["prenom"]);
$emetteur=encoderEnHtml($enreg["email"]);
}
// recuperation des elements du destinataire
$sql = "SELECT nom, prenom, email FROM ".$DB_schema."t_utilisateur WHERE codeutilisateur='$codeDestinataire'";
$res=$req->execute ($sql);
while($enreg = $req->tableauAssociatif ($res))
{
$nomDestinataire=encoderEnHtml($enreg["nom"]." ".$enreg["prenom"]);
$emailDestinataire=encoderEnHtml($enreg["email"]);
}
$courriel->AltBody = $message;
$monTexte = "";
$monTexte.= "";
// $monTexte.= "| ".formatHtml2($message)." |
";
$monTexte.= "| ".formatHtml2($message)." |
";
$monTexte.= "
";
// $courriel->Body = $monTexte;
$courriel->Body = $message;
if($objetMail!="")
$courriel->Subject = $objetMail;
else
$courriel->Subject = "Infos";
/*on recupere les coordonnées de l'envoyeur*/
$courriel->From = $emetteur;
$courriel->FromName = $nomEmetteur;
$courriel->AddReplyTo($emetteur, "");
$courriel->AddAddress($emailDestinataire, "");
//envoi du message
if(!$courriel->Send())
{
$messageRetour = "Message could not be sent.
";
$messageRetour.= "Mailer Error: " . $courriel->ErrorInfo."";
}
else
{
$messageRetour="Message envoyé";
}
return $messageRetour;
}
?>
/** ADU Postgres OK */
function verifierIdentifiantBaseDeDonnee($req,$mail,$password)
{
global $DB_schema;
$codeUtilisateur="";
$mail = protegerVariableSQL($req, $mail);
$password = protegerVariableSQL($req, $password);
$sql = "SELECT CODEUTILISATEUR FROM ".$DB_schema."t_utilisateur WHERE EMAIL='$mail' OR (EMAIL='$mail' AND PASSWD='".md5($password)."')";
$res=$req->execute ($sql);
while($enreg = $req->tableauAssociatif ($res))
{
$codeUtilisateur=$enreg["codeutilisateur"];
}
return $codeUtilisateur;
}
function insererCompteDonnee($req,$nom,$prenom,$mail,$password)
{
global $DB_schema;
$nom = protegerVariableSQL($req, $nom);
$prenom = protegerVariableSQL($req, $prenom);
$mail = protegerVariableSQL($req, $mail);
$password = protegerVariableSQL($req, $password);
$sql="INSERT INTO ".$DB_schema."t_utilisateur (NOM, PRENOM, EMAIL, PASSWD) ";
$sql.="VALUES ('$nom', '$prenom', '$mail', '$password')";
$codeUtilisateur = $req->insert($sql,'codeutilisateur');
return $codeUtilisateur;
}
/*fin de fonction CODEVER*/
function verifierDateValiditeInscription($req,$codeUtilisateur)
{
global $DB_schema;
$dateValidationInscription="";
$codeUtilisateur = protegerVariableSQL($req, $codeUtilisateur);
$sql = "SELECT DATEVALIDATIONINSCRIPTION FROM ".$DB_schema."t_utilisateur WHERE CODEUTILISATEUR='$codeUtilisateur'";
$res=$req->execute ($sql);
while($enreg = $req->tableauAssociatif ($res))
{
$dateValidationInscription=$enreg["datevalidationinscription"];
}
if($dateValidationInscription=="0000-00-00 00:00:00")
$dateValidationInscription="";
return $dateValidationInscription;
}
function insererCompteUtilisateur($req,$codeCivilite,$nom,$prenom,$mail,$password)
{
global $DB_schema;
$sql="INSERT INTO ".$DB_schema."t_utilisateur (CODECIVILITE, NOM, PRENOM, LOGIN, EMAIL, PASSWD, CODENIVEAU) ";
$sql.="VALUES ('$codeCivilite', '$nom', '$prenom', '$mail', '$mail', '$password', '5')";
$codeUtilisateur = $req->insert($sql,'codeutilisateur');
return $codeUtilisateur;
}
function modifierUtilisateurLogin($req,$codeUtilisateur,$login)
{
global $DB_schema;
$sql = "UPDATE ".$DB_schema."t_utilisateur SET LOGIN='$login' WHERE CODEUTILISATEUR ='$codeUtilisateur'";
$req->execute($sql);
return $codeUtilisateur;
}
function modifierUtilisateurMotDePasse($req,$codeUtilisateur,$passwd)
{
global $DB_schema;
$codeUtilisateur = protegerVariableSQL($req, $codeUtilisateur);
$sql = "UPDATE ".$DB_schema."t_utilisateur SET PASSWD='$passwd' WHERE CODEUTILISATEUR ='$codeUtilisateur'";
// echo $sql;
$req->execute($sql);
return $codeUtilisateur;
}
?>
Extranet AFAC24

Extranet AFAC24
Chargement en cours...
include("../include/bas.inc.php");
$req->ferme();
?>