public function redeem()
 {
     $code = $this->request()->getPost('code');
     $phone = $this->request()->getPost('phone');
     if ($code && $phone) {
         $code = strtoupper($code);
         $phone = Application_Model_Utility::cleanPhone($phone);
         if ($phone[0] != 1 && strlen($phone) == 10) {
             $phone = '1' . $phone;
         }
         $sql = "CALL luckderby_add_redemption('{$code}', {$phone})";
         $rs = $this->query($sql);
         if ($rs && $rs->num_rows) {
             $this->success = $rs->success;
             $this->message = $rs->message;
         } else {
             $this->message = 'Could not redeem code ' . $code . '. Please contact textmunication for assistance.';
         }
     } else {
         $this->message = 'A code and a phone number are required.';
     }
 }
示例#2
0
 /**
  * Generates a session id
  * 
  * @access public
  * @param int $length Length to use for the random seed string to build the session id from
  * @param boolean $all Flag that tells the id maker to user upper and lower case
  * @return string $length long string of ascii chars
  */
 public function generateId($length = self::IDLENGTH, $all = true)
 {
     // Get a random string then salt it and MD5 it
     return md5(uniqid() . Application_Model_Utility::getRandomString($length, $all) . self::IDSALT);
 }
示例#3
0
 /**
  * Sets the admin phone
  * 
  * @param string $phone
  */
 public function setAdminPhone($phone)
 {
     if ($phone) {
         $phone = Application_Model_Utility::cleanPhone($phone);
         if ($phone[0] != 1) {
             $phone = '1' . $phone;
         }
     }
     $this->admin_phone = $phone;
 }