A l'inscription l'envois de mail de confirmat
Fermé
Profil bloqué
-
11 août 2009 à 21:50
voyageur59 Messages postés 1112 Date d'inscription vendredi 7 décembre 2007 Statut Membre Dernière intervention 10 novembre 2009 - 12 août 2009 à 09:45
voyageur59 Messages postés 1112 Date d'inscription vendredi 7 décembre 2007 Statut Membre Dernière intervention 10 novembre 2009 - 12 août 2009 à 09:45
A voir également:
- A l'inscription l'envois de mail de confirmat
- Yahoo mail - Guide
- Instagram inscription - Guide
- Facebook inscription - Guide
- Publipostage mail - Guide
- Créer un compte yahoo mail gratuit avec capacité de - Guide
1 réponse
voyageur59
Messages postés
1112
Date d'inscription
vendredi 7 décembre 2007
Statut
Membre
Dernière intervention
10 novembre 2009
132
12 août 2009 à 09:45
12 août 2009 à 09:45
Bonjour,
J'ai pas tout épluché le code car il faudrai y passer tu temps...
En tout cas, quelque chose m'interpelle:
Beste $login
Hieronder staan uw login-gegevens vermeld.
Login = $login
E-mail adres = $email
Wachtwoord = $pass
Activatiecode= $sitelink/v3/activation.php?login=$login&code=$user->activationcode
Om te kunnen spelen moet je account bij ons bevestigd zijn.
Met vriendelijke groet,
Het $page->sitetitle Team.","From: $page->sitetitle <snake@streetgangz.nl>");
Tu as du copier le code quelque part sans en comprendre le sens et en laissant les commentaires.
Le mieux est donc malgré tout de reprendre à 0 et voir la classe "mail" comment elle est composée et comment elle est utilisée.
Tu as par exemple ceci (pris dans ce qui m'interpelle):
E-mail adres = $email
La variable "E-mail adres" est composée de 2 mots, ce n'est pas possible une variable c'est toujours 1 mot.
Ensuite pour un message de récupération de mot de passe ou de confirmation, ça me semble un peu long.
Voici par exemple une class mail complète qui envoi à qui tu veux un mail, dont le contenu est récupéré par $_GET['texte']...
En remplaçant ces deux lignes par un contenu par défaut tu peux même créer un mail par défaut (en cas d'erreur etc...):
$objet="";
$texte="";
C'est un exemple bien sur (en prime tu as la possibité de mettre une pièce jointe):
<?php
if (!isset($_GET['from']))
$from="ADRESSE-MAIL-PAR-DEFAUT";
else
$from=$_GET['from'];
if (!isset($_GET['destinataire']))
$destinataire="DESTINATAIRE-PAR-DEFAUT";
else
$destinataire=$_GET['destinataire'];
if (!isset($_GET['priority']))
$priority="";
else
$priority=$_GET['priority'];
if (!isset($_GET['objet']))
$objet="";
else
$objet=$_GET['objet'];
if (!isset($_GET['texte']))
$texte="";
else
$texte=$_GET['texte'];
class Mail
{
var $sendto= array();
var $from, $msubject;
var $acc= array();
var $abcc= array();
var $aattach= array();
var $priorities= array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
function Mail()
{
$this->autoCheck( true );
}
function autoCheck( $bool )
{
if( $bool )
$this->checkAddress = true;
else
$this->checkAddress = false;
}
function Subject( $subject )
{
$this->msubject = strtr( $subject, "\r\n" , " " );
}
function From( $from )
{
if( ! is_string($from) ) {
exit;
}
$this->from= $from;
}
function To( $to )
{
if( is_array( $to ) )
$this->sendto= $to;
else
$this->sendto[] = $to;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->sendto );
}
function Cc( $cc )
{
if( is_array($cc) )
$this->acc= $cc;
else
$this->acc[]= $cc;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->acc );
}
function Bcc( $bcc )
{
if( is_array($bcc) ) {
$this->abcc = $bcc;
} else {
$this->abcc[]= $bcc;
}
if( $this->checkAddress == true )
$this->CheckAdresses( $this->abcc );
}
function Body( $body )
{
$this->body= $body;
}
function Send()
{
$this->_build_headers();
if( sizeof( $this->aattach > 0 ) ) {
$this->_build_attachement();
$body = $this->fullBody . $this->attachment;
}
// envoie du mail aux destinataires principal
for( $i=0; $i< sizeof($this->sendto); $i++ ) {
$res = mail($this->sendto[$i], $this->msubject,$body, $this->headers);
}
}
function Organization( $org )
{
if( trim( $org != "" ) )
$this->organization= $org;
}
function Priority( $priority )
{
if( ! intval( $priority ) )
return false;
if( ! isset( $this->priorities[$priority-1]) )
return false;
$this->priority= $this->priorities[$priority-1];
return true;
}
function Attach( $filename, $filetype='application/x-unknown-content-type', $disposition = "inline" )
{
$this->aattach[] = $filename;
$this->actype[] = $filetype;
$this->adispo[] = $disposition;
}
function Get()
{
$this->_build_headers();
if( sizeof( $this->aattach > 0 ) ) {
$this->_build_attachement();
$this->body= $this->body . $this->attachment;
}
$mail = $this->headers;
$mail .= "\n$this->body";
return $mail;
}
function ValidEmail($address)
{
if( ereg( ".*<(.+)>", $address, $regs ) ) {
$address = $regs[1];
}
if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) )
return true;
else
return false;
}
function CheckAdresses( $aad )
{
for($i=0;$i< sizeof( $aad); $i++ ) {
if( ! $this->ValidEmail( $aad[$i]) ) {
exit;
}
}
}
function _build_headers()
{
$this->headers= "From: $this->from\n";
$this->to= implode( ", ", $this->sendto );
if( count($this->acc) > 0 ) {
$this->cc= implode( ", ", $this->acc );
$this->headers .= "CC: $this->cc\n";
}
if( count($this->abcc) > 0 ) {
$this->bcc= implode( ", ", $this->abcc );
$this->headers .= "BCC: $this->bcc\n";
}
if( $this->organization != "" )
$this->headers .= "Organization: $this->organization\n";
if( $this->priority != "" )
$this->headers .= "X-Priority: $this->priority\n";
}
function _build_attachement()
{
$this->boundary= "------------" . md5( uniqid("myboundary") );
$this->headers .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$this->boundary\"\n\n";
$this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\nContent-Type: text/html; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit\n\n" . $this->body ."\n";
$sep= chr(13) . chr(10);
$ata= array();
$k=0;
// for each attached file, do...
for( $i=0; $i < sizeof( $this->aattach); $i++ ) {
$filename = $this->aattach[$i];
$basename = basename($filename);
$ctype = $this->actype[$i]; // content-type
$disposition = $this->adispo[$i];
if( ! file_exists( $filename) ) {
exit;
}
$subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n filename=\"$basename\"\n";
$ata[$k++] = $subhdr;
$linesz= filesize( $filename)+1;
$fp= fopen( $filename, 'r' );
$data= base64_encode(fread( $fp, $linesz));
fclose($fp);
$ata[$k++] = chunk_split( $data );
}
$this->attachment= implode($sep, $ata);
}
} // class Mail
$m= new Mail; // crée le mail
// ############# contenu du mail ########
$m->From( "$from" );
$m->To( "$destinataire");
$m->Subject( "$objet" );
$m->Body("$texte");
$m->Priority($priority) ;
// #################################
if ($texte!="" && $destinataire!="" && strpos($destinataire, "@")>0 && strpos(strstr($destinataire, "@"),".")>0 )
$m->Send();
?>
J'ai pas tout épluché le code car il faudrai y passer tu temps...
En tout cas, quelque chose m'interpelle:
Beste $login
Hieronder staan uw login-gegevens vermeld.
Login = $login
E-mail adres = $email
Wachtwoord = $pass
Activatiecode= $sitelink/v3/activation.php?login=$login&code=$user->activationcode
Om te kunnen spelen moet je account bij ons bevestigd zijn.
Met vriendelijke groet,
Het $page->sitetitle Team.","From: $page->sitetitle <snake@streetgangz.nl>");
Tu as du copier le code quelque part sans en comprendre le sens et en laissant les commentaires.
Le mieux est donc malgré tout de reprendre à 0 et voir la classe "mail" comment elle est composée et comment elle est utilisée.
Tu as par exemple ceci (pris dans ce qui m'interpelle):
E-mail adres = $email
La variable "E-mail adres" est composée de 2 mots, ce n'est pas possible une variable c'est toujours 1 mot.
Ensuite pour un message de récupération de mot de passe ou de confirmation, ça me semble un peu long.
Voici par exemple une class mail complète qui envoi à qui tu veux un mail, dont le contenu est récupéré par $_GET['texte']...
En remplaçant ces deux lignes par un contenu par défaut tu peux même créer un mail par défaut (en cas d'erreur etc...):
$objet="";
$texte="";
C'est un exemple bien sur (en prime tu as la possibité de mettre une pièce jointe):
<?php
if (!isset($_GET['from']))
$from="ADRESSE-MAIL-PAR-DEFAUT";
else
$from=$_GET['from'];
if (!isset($_GET['destinataire']))
$destinataire="DESTINATAIRE-PAR-DEFAUT";
else
$destinataire=$_GET['destinataire'];
if (!isset($_GET['priority']))
$priority="";
else
$priority=$_GET['priority'];
if (!isset($_GET['objet']))
$objet="";
else
$objet=$_GET['objet'];
if (!isset($_GET['texte']))
$texte="";
else
$texte=$_GET['texte'];
class Mail
{
var $sendto= array();
var $from, $msubject;
var $acc= array();
var $abcc= array();
var $aattach= array();
var $priorities= array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
function Mail()
{
$this->autoCheck( true );
}
function autoCheck( $bool )
{
if( $bool )
$this->checkAddress = true;
else
$this->checkAddress = false;
}
function Subject( $subject )
{
$this->msubject = strtr( $subject, "\r\n" , " " );
}
function From( $from )
{
if( ! is_string($from) ) {
exit;
}
$this->from= $from;
}
function To( $to )
{
if( is_array( $to ) )
$this->sendto= $to;
else
$this->sendto[] = $to;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->sendto );
}
function Cc( $cc )
{
if( is_array($cc) )
$this->acc= $cc;
else
$this->acc[]= $cc;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->acc );
}
function Bcc( $bcc )
{
if( is_array($bcc) ) {
$this->abcc = $bcc;
} else {
$this->abcc[]= $bcc;
}
if( $this->checkAddress == true )
$this->CheckAdresses( $this->abcc );
}
function Body( $body )
{
$this->body= $body;
}
function Send()
{
$this->_build_headers();
if( sizeof( $this->aattach > 0 ) ) {
$this->_build_attachement();
$body = $this->fullBody . $this->attachment;
}
// envoie du mail aux destinataires principal
for( $i=0; $i< sizeof($this->sendto); $i++ ) {
$res = mail($this->sendto[$i], $this->msubject,$body, $this->headers);
}
}
function Organization( $org )
{
if( trim( $org != "" ) )
$this->organization= $org;
}
function Priority( $priority )
{
if( ! intval( $priority ) )
return false;
if( ! isset( $this->priorities[$priority-1]) )
return false;
$this->priority= $this->priorities[$priority-1];
return true;
}
function Attach( $filename, $filetype='application/x-unknown-content-type', $disposition = "inline" )
{
$this->aattach[] = $filename;
$this->actype[] = $filetype;
$this->adispo[] = $disposition;
}
function Get()
{
$this->_build_headers();
if( sizeof( $this->aattach > 0 ) ) {
$this->_build_attachement();
$this->body= $this->body . $this->attachment;
}
$mail = $this->headers;
$mail .= "\n$this->body";
return $mail;
}
function ValidEmail($address)
{
if( ereg( ".*<(.+)>", $address, $regs ) ) {
$address = $regs[1];
}
if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) )
return true;
else
return false;
}
function CheckAdresses( $aad )
{
for($i=0;$i< sizeof( $aad); $i++ ) {
if( ! $this->ValidEmail( $aad[$i]) ) {
exit;
}
}
}
function _build_headers()
{
$this->headers= "From: $this->from\n";
$this->to= implode( ", ", $this->sendto );
if( count($this->acc) > 0 ) {
$this->cc= implode( ", ", $this->acc );
$this->headers .= "CC: $this->cc\n";
}
if( count($this->abcc) > 0 ) {
$this->bcc= implode( ", ", $this->abcc );
$this->headers .= "BCC: $this->bcc\n";
}
if( $this->organization != "" )
$this->headers .= "Organization: $this->organization\n";
if( $this->priority != "" )
$this->headers .= "X-Priority: $this->priority\n";
}
function _build_attachement()
{
$this->boundary= "------------" . md5( uniqid("myboundary") );
$this->headers .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$this->boundary\"\n\n";
$this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\nContent-Type: text/html; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit\n\n" . $this->body ."\n";
$sep= chr(13) . chr(10);
$ata= array();
$k=0;
// for each attached file, do...
for( $i=0; $i < sizeof( $this->aattach); $i++ ) {
$filename = $this->aattach[$i];
$basename = basename($filename);
$ctype = $this->actype[$i]; // content-type
$disposition = $this->adispo[$i];
if( ! file_exists( $filename) ) {
exit;
}
$subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n filename=\"$basename\"\n";
$ata[$k++] = $subhdr;
$linesz= filesize( $filename)+1;
$fp= fopen( $filename, 'r' );
$data= base64_encode(fread( $fp, $linesz));
fclose($fp);
$ata[$k++] = chunk_split( $data );
}
$this->attachment= implode($sep, $ata);
}
} // class Mail
$m= new Mail; // crée le mail
// ############# contenu du mail ########
$m->From( "$from" );
$m->To( "$destinataire");
$m->Subject( "$objet" );
$m->Body("$texte");
$m->Priority($priority) ;
// #################################
if ($texte!="" && $destinataire!="" && strpos($destinataire, "@")>0 && strpos(strstr($destinataire, "@"),".")>0 )
$m->Send();
?>