Advertisement
Guest User

register user send e-mail

a guest
Dec 19th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.18 KB | None | 0 0
  1. require_once("class.phpmailer.php");
  2. require_once("formvalidator.php");
  3.  
  4. class FGMembersite
  5. {
  6.     var $admin_email;
  7.     var $from_address;
  8.    
  9.     var $username;
  10.     var $pwd;
  11.     var $database;
  12.     var $tablename;
  13.     var $connection;
  14.     var $rand_key;
  15.    
  16.     var $error_message;
  17.    
  18.     //-----Initialization -------
  19.     function FGMembersite()
  20.     {
  21.         $this->sitename = mydropbox.com';
  22.        $this->rand_key = '0iQx5oBk66oVZep';
  23.    }
  24.    
  25.    function InitDB($host,$uname,$pwd,$database,$tablename)
  26.    {
  27.        $this->db_host  = $host;
  28.        $this->username = $uname;
  29.        $this->pwd  = $pwd;
  30.        $this->database  = $database;
  31.        $this->tablename = $tablename;
  32.        
  33.    }
  34.    function SetAdminEmail($email)
  35.    {
  36.        $this->admin_email = $email;
  37.    }
  38.    
  39.    function SetWebsiteName($sitename)
  40.    {
  41.        $this->sitename = $sitename;
  42.    }
  43.    
  44.    function SetRandomKey($key)
  45.    {
  46.        $this->rand_key = $key;
  47.    }
  48.    
  49.    //Main Operations
  50.    function RegisterUser()
  51.    {
  52.        if(!isset($_POST['submitted']))
  53.        {
  54.           return false;
  55.        }
  56.        
  57.        $formvars = array();
  58.        
  59.        if(!$this->ValidateRegistrationSubmission())
  60.        {
  61.            return false;
  62.        }
  63.        
  64.        $this->CollectRegistrationSubmission($formvars);
  65.        
  66.        if(!$this->SaveToDatabase($formvars))
  67.        {
  68.            return false;
  69.        }
  70.        
  71.        if(!$this->SendUserConfirmationEmail($formvars))
  72.        {
  73.            return false;
  74.        }
  75.  
  76.        $this->SendAdminIntimationEmail($formvars);
  77.        
  78.        return true;
  79.    }
  80.  
  81.    function ConfirmUser()
  82.    {
  83.        if(empty($_GET['code'])||strlen($_GET['code'])<=10)
  84.        {
  85.            $this->HandleError("Please provide the confirm code");
  86.            return false;
  87.        }
  88.        $user_rec = array();
  89.        if(!$this->UpdateDBRecForConfirmation($user_rec))
  90.        {
  91.            return false;
  92.        }
  93.        
  94.        $this->SendUserWelcomeEmail($user_rec);
  95.        
  96.        $this->SendAdminIntimationOnRegComplete($user_rec);
  97.        
  98.        return true;
  99.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement