Author Topic: E-mail Notification - on new registers  (Read 618 times)

0 Members and 1 Guest are viewing this topic.

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
E-mail Notification - on new registers
« on: March 05, 2010, 01:58:04 PM »
Would this be a good idea? to have admin and user sent a e-mail when they register?

If so I can finish this code

*************************************
Admin Email on register and user e-mail Yes or No

Step one

Step 1

update add this to the en-gb.inc.php
Code: [Select]
$smarty->assign('LAN_207', 'Send E-mail to Admin on User Register');
$smarty->assign('LAN_208', 'Send E-mail to User on Register');


Step 2

add this to option.tbl about the <!--Footer-->

Code: [Select]
<tr>
<td class="first"><strong>{$LAN_207}</strong></td>
<td class="last">
<label><input name="eonregister" type="radio" value="Yes" {if $options[options].eonregister eq "Yes"}checked="checked"{/if} />Yes</label>
<label><input name="eonregister" type="radio" value="No" {if $options[options].eonregister eq "No"}checked="checked"{/if} />No</label>
</td>
</tr>


</tr>
<tr>
<td class="first"><strong>{$LAN_208}</strong></td>
<td class="last">
<label><input name="uonregister" type="radio" value="Yes" {if $options[options].uonregister eq "Yes"}checked="checked"{/if} />Yes</label>
<label><input name="uonregister" type="radio" value="No" {if $options[options].uonregister eq "No"}checked="checked"{/if} />No</label>
</td>
</tr>


step 3
go into mysql and run this

Code: [Select]
alter table pp_config add column eonregister varchar (5) NOT NULL default 'Yes';
alter table pp_config add column uonregister varchar (5) NOT NULL default 'Yes';

step 4


edit the admin.options.php


add

Code: [Select]
mysql_query("UPDATE pp_config SET eonregister= '$_POST[eonregister]'");
mysql_query("UPDATE pp_config SET uonregister= '$_POST[uonregister]'");

[code]
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: E-mail Notification - on new registers
« Reply #1 on: March 06, 2010, 04:41:45 AM »
new register.php for e-mails

Code: [Select]

<?php
/*
+ ----------------------------------------------------------------------------+
|     PHPDirector.
|      $License: GNU General Public License
|      $Website: phpdirector.co.uk
+----------------------------------------------------------------------------+
*/
require('header.php');

 
session_start();
   if((
$_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
      
unset($_SESSION['security_code']);

}
include 
'db.php';
if(isset(
$_COOKIE["id"]))
{
     
header("Location: index.php");
}
else
{
     if(
$_POST["BT_Envoyer"])
     {
          
          
// Vérification de la validité des champs
          
if(!ereg("^[A-Za-z0-9_]{4,20}$"$_POST["TB_Nom_Utilisateur"]))
          {
               
$message "You login must be longer than 4 and less than 20 character<br />\n";
          
          }
          elseif(!
ereg("^[A-Za-z0-9]{4,}$"$_POST["TB_Mot_de_Passe"]))
          {
               
$message "Your password must be longer than 4 character";
          }
          elseif(
$_POST["TB_Mot_de_Passe"] != $_POST["TB_Confirmation_Mot_de_Passe"])
          {
               
$message "Password don't match";
          }
          elseif(!
ereg("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,4}$",
               
$_POST["TB_Adresse_Email"]))
          {
               
$message "Your E-mail is not valid";
         
 
     }


else
          {

               
$result mysql_query("
                    SELECT user
                         , email
                    FROM pp_user
                    WHERE user = '" 
$_POST["TB_Nom_Utilisateur"] . "'
                    OR email = '" 
$_POST["TB_Adresse_Email"] . "'
               "
);
               
               
// Si une erreur survient
               
if(!$result)
               {
                    
$message "Internal error";
               }
               else
               {
                    
                    
// Si un enregistrement est trouvé
                    
if(mysql_num_rows($result) > 0)
                    {
                         
                         while(
$row mysql_fetch_array($result))
                         {
                              
                              if(
$_POST["TB_Nom_Utilisateur"] == $row["Nom_Utilisateur"])
                              {
                                   
$message "" $_POST["TB_Nom_Utilisateur"];
                                   
$message .= "os already used";
                              }
                              elseif(
$_POST["TB_Adresse_Email"] == $row["email"])
                              {
                                   
$message "This E-mail : " $_POST["TB_Adresse_Email"];
                                   
$message .= "is already used";
                              }
                              
                         }
                         
                    }
          
      
// Insert your code for showing an error message here
     
if(($_SESSION['security_code'] != $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
      
unset($_SESSION['security_code']);

 
$message "Sorry, you have provided an invalid security code";   

}    


else
                    {
                         
                         
                         
// Création du compte utilisateur
                         
$result mysql_query("
                              INSERT INTO pp_user(user,pass,email,register)
                              VALUES('
$_POST[TB_Nom_Utilisateur]','".md5($_POST['TB_Mot_de_Passe'])."','$_POST[TB_Adresse_Email]',CURRENT_DATE())
                         "
);
                         
                         
// Si une erreur survient
                         
if(!$result)
                         {
                              
$message "An internal error has occured";
                         }
                         else
                         {
                                   
                                   
// Message de confirmation
                                   
$message "Congratulations ".$_POST['TB_Nom_Utilisateur'].", your account has been created, you can now start to play<br />\n";
                                   

                                   
                              }
                              
                         
}
                         
                    }
                    
               }
               
        
  }
          
    
 }
  


$smarty->assign('message'$message);         
$smarty->display('register.tpl');
   
$ip $_SERVER['REMOTE_ADDR'];
$submitter $TB_Nom_Utilisateur;
$eonregister = $_GET[eonregister];



if(
$eonregister 'Yes'//OR ($eonregister = 'Yes'))

{
$data mysql_query("SELECT * FROM pp_config") or die(mysql_error()); 

while(
$info mysql_fetch_array$data )) 

// admin email address
$email $info['aemail'];
$sitename $info['name'];

}

$data1 mysql_query("SELECT id FROM pp_files") or die(mysql_error());
while(
$info1 mysql_fetch_array$data1 )) 

 
$id1 $info1['id'];


$data mysql_query("SELECT email FROM pp_user where user = '$submitter'") or die(mysql_error()); 

while(
$infouser mysql_fetch_array$data )) 

// user email address
$emailuser $infouser['email'];


// The subject
$subject 'Someone just registered at '."$sitename";



$headers "From: " strip_tags($email) . "\r\n";
$headers .= "Reply-To: "strip_tags($_POST['req-email']) . "\r\n";
//$headers .= "CC: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message '<html><body>';
$message .= '<img src="http://www.myfunnypets.com/30/templates/default/images/logo.png" alt="Powered by PHPDirector" />';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>User Name:</strong> </td><td>" strip_tags($TB_Nom_Utilisateur) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" strip_tags($emailuser) . "</td></tr>";
$message .= "<tr><td><strong>Password:</strong> </td><td>" strip_tags($TB_Mot_de_Passe) . "</td></tr>";
$message .= "<tr><td><strong>User IP Address:</strong> </td><td>" $ip "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";


//mail($email, $subject, $message, $headers, "From: $email");

mail($email$subject$message$headers);




}
else
{

}


$uonregister = $_GET[uonregister];


if(
$uonregister 'Yes')

{
$data mysql_query("SELECT email FROM pp_user where user = '$submitter'") or die(mysql_error()); 

while(
$info mysql_fetch_array$data )) 

// user email address
$email $info['email'];


$data1 mysql_query("SELECT id FROM pp_files") or die(mysql_error());
while(
$info1 mysql_fetch_array$data1 )) 

$id1 $info1['id'];


// The subject
$subject 'thanks for registering at '"$sitename";

// The message
$headers "From: " strip_tags($email) . "\r\n";
$headers .= "Reply-To: "strip_tags($_POST['req-email']) . "\r\n";
//$headers .= "CC: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message '<html><body>';
$message .= '<img src="http://www.myfunnypets.com/30/templates/default/images/logo.png" alt="Powered by PHPDirector" />';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>User Name:</strong> </td><td>" strip_tags($TB_Nom_Utilisateur) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" strip_tags($emailuser) . "</td></tr>";
$message .= "<tr><td><strong>Password:</strong> </td><td>" strip_tags($TB_Mot_de_Passe) . "</td></tr>";
$message .= "<tr><td><strong>Login At " ."$sitename"."</strong> </td><td>"."http://" $_SERVER['SERVER_NAME']. "</td></tr>";
$message .= "<tr><td><strong>User IP Address:</strong> </td><td>" $ip "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";


mail($email$subject$message$headers);


}
else
{

}


?>

winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: E-mail Notification - on new registers
« Reply #2 on: March 06, 2010, 05:04:24 AM »
please let me know if you see any bugs
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline ultrafoxus

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
    • sbobet
Re: E-mail Notification - on new registers
« Reply #3 on: June 01, 2010, 02:45:37 PM »
thank you for all information  8)