PHP Classes

File: send_registrationmail.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   tinyUGatMs   send_registrationmail.php   Download  
File: send_registrationmail.php
Role: Auxiliary script
Content type: text/plain
Description: php script for send with ajax registration mail
Class: tinyUGatMs
Manage users and groups of events in a database
Author: By
Last change:
Date: 7 years ago
Size: 1,091 bytes
 

Contents

Class file image Download
<?php
    session_start
();
        require_once(
'./config.php');
       
$t=time();
       
$idvalidation=md5(str_shuffle($_POST['user'].$_POST['firstname'].$t));
       
$req=$bdd->prepare('UPDATE users SET idvalidation=:idvalidation WHERE username=:user');
       
$req->execute(array('idvalidation'=>$idvalidation,'user'=>$_POST['user']));
       
$req->CloseCursor();

    if(isset(
$_POST['user'])){
       
$email = $_POST['mail'];
       
$message = 'Welcome to our website'.$_POST['firstname'].' '.$_POST['lastname'].'<br>
        Your username is '
.$_POST['user'].'
        This is your validation link<a href="http://www.monsite.fr/validation.php?id="'
.$idvalidation.'" >click here</a>.';
       
$destinataire = $email;
       
$objet = "Registration on MonSite.fr" ;
       
$headers = 'MIME-Version: 1.0' . "\r\n";
       
$headers .= 'Content-type: text/html; charset=iso-8859-
        1'
. "\r\n";
       
$headers .= 'From: monsite@monsite.fr' . "\r\n";
        if (
mail($destinataire, $objet, $message, $headers)){
            echo
"mail successfully sent";
        }else{
            return
'mail failed to be sent';
        }
    }else{
                return
'mail failed to be sent';
    }
   
?>