Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function validateAndSend()
- {
- if ( strtolower( $this->request['EmailAddress'] ) == "enter your email address here..." || $this->request['EmailAddress'] == "" )
- {
- $this->buildPage ( 'default', 'no_email' );
- return '';
- }
- if ( !IPSText::checkEmailAddress( $this->request['EmailAddress'] ) )
- {
- $this->buildPage( 'default', 'bad_email');
- return '';
- }
- /**
- * Run DB query to check for existing invite.
- */
- $this->DB->build( array( 'select' => 'email',
- 'from' => 'invite',
- 'where' => 'email="'.$this->request['EmailAddress'].'"'
- )
- );
- $this->DB->execute();
- if ( $this->DB->getTotalRows() )
- {
- $this->buildPage( 'default', 'invite_sent' );
- return '';
- }
- /**
- * </END>
- * <BEGIN>
- * Check if member exists with same email address.
- */
- $this->DB->build( array( 'select' => 'email',
- 'from' => 'members',
- 'where' => 'email="'.$this->request['EmailAddress'].'"'
- )
- );
- $this->DB->execute();
- if ( $this->DB->getTotalRows() )
- {
- $this->buildPage ( 'default', 'member_exist' );
- return '';
- }
- /**
- * </END>
- */
- IPSText::getTextClass('email')->subject = "Reqest from " . $this->request['EmailAddress'];
- IPSText::getTextClass('email')->to = isset( $this->toEmail ) ? $this->toEmail : "webmaster@gamingsynergies.net";
- IPSText::getTextClass('email')->message = str_replace( "<#EMAIL#>", $this->request['EmailAddress'], $this->message);
- if ( IPSText::getTextClass('email')->sendMail() == TRUE )
- {
- /**
- * Add Invite Request to the DB
- */
- $this->DB->insert( 'invite', array( 'email' => $this->request['EmailAddress'],
- 'name' => null,
- 'xboxgt' => null,
- 'claimed' => 0,
- 'date_request' => time()
- )
- );
- $this->buildPage( 'success' );
- } else {
- $this->buildPage( 'default', 'err');
- }
- }
Add Comment
Please, Sign In to add comment