Guest User

Untitled

a guest
Dec 11th, 2017
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. public function validateAndSend()
  2.     {      
  3.         if ( strtolower( $this->request['EmailAddress'] ) == "enter your email address here..." || $this->request['EmailAddress'] == ""  )
  4.         {
  5.             $this->buildPage ( 'default', 'no_email' );
  6.             return ''; 
  7.         }
  8.        
  9.         if ( !IPSText::checkEmailAddress( $this->request['EmailAddress'] ) )
  10.         {
  11.             $this->buildPage( 'default', 'bad_email');
  12.             return '';
  13.         }
  14.        
  15.         /**
  16.         * Run DB query to check for existing invite.
  17.         */
  18.         $this->DB->build(  array(   'select'    => 'email',
  19.                                     'from'      => 'invite',
  20.                                     'where'     => 'email="'.$this->request['EmailAddress'].'"'
  21.                                 )
  22.                         );
  23.         $this->DB->execute();
  24.         if ( $this->DB->getTotalRows() )
  25.         {
  26.             $this->buildPage( 'default', 'invite_sent' );
  27.             return ''; 
  28.         }
  29.        
  30.         /**
  31.         * </END>
  32.         * <BEGIN>
  33.         * Check if member exists with same email address.
  34.         */
  35.         $this->DB->build( array(    'select'    => 'email',
  36.                                     'from'      => 'members',
  37.                                     'where'     => 'email="'.$this->request['EmailAddress'].'"'
  38.                                 )
  39.                          );
  40.         $this->DB->execute();
  41.         if ( $this->DB->getTotalRows() )
  42.         {
  43.             $this->buildPage ( 'default', 'member_exist' );
  44.             return ''; 
  45.         }
  46.         /**
  47.         * </END>
  48.         */     
  49.  
  50.         IPSText::getTextClass('email')->subject     =   "Reqest from " . $this->request['EmailAddress'];
  51.         IPSText::getTextClass('email')->to          =   isset( $this->toEmail ) ? $this->toEmail : "webmaster@gamingsynergies.net";
  52.         IPSText::getTextClass('email')->message     =   str_replace( "<#EMAIL#>", $this->request['EmailAddress'], $this->message);
  53.         if ( IPSText::getTextClass('email')->sendMail() == TRUE )
  54.         {
  55.             /**
  56.             * Add Invite Request to the DB
  57.             */
  58.             $this->DB->insert( 'invite', array( 'email'     => $this->request['EmailAddress'],
  59.                                                 'name'      => null,
  60.                                                 'xboxgt'    => null,
  61.                                                 'claimed'   => 0,
  62.                                                 'date_request' => time()
  63.                                                 )
  64.                              );        
  65.             $this->buildPage( 'success' );
  66.         } else {
  67.             $this->buildPage( 'default', 'err');
  68.         }
  69.     }
Add Comment
Please, Sign In to add comment