public function execute() { $this->checkDefaultApp($this->aid); if (isset($this->email) && !Validate::email($this->email)) { throw new OpenFBAPIException('Email address "' . $this->email . '" not valid.'); } if (isset($this->phone) && !Validate_US::phoneNumber($this->phone)) { throw new OpenFBAPIException('Phone number "' . $this->phone . '" not valid.'); } $friends = array(); $friendUids = split(',', $this->friends); foreach ($friendUids as $friendUid) { $friends[] = array('uid' => $friendUid, 'nid' => $this->nid); //TODO: Support case where friend is not a user in the deployed network (i.e. in the users table) } $result = Api_Bo_Subscriptions::createFriendsAppSubscription($this->uid, $this->nid, $this->aid, $this->planid, $this->ccn, $this->cctype, $this->expdate, $friends, $this->firstname, $this->lastname, $this->email, $this->phone); return $result; }
public function execute() { $this->checkDefaultApp($this->aid); if (isset($this->email) && !Validate::email($this->email)) { throw new OpenFBAPIException('Email address "' . $this->email . '" not valid.'); } if (isset($this->phone) && !Validate_US::phoneNumber($this->phone)) { throw new OpenFBAPIException('Phone number "' . $this->phone . '" not valid.'); } $result = Api_Bo_Subscriptions::createAppSubscription($this->uid, $this->nid, $this->aid, $this->planid, $this->ccn, $this->cctype, $this->expdate, $this->firstname, $this->lastname, $this->email, $this->phone); return $result; }
/** * checks if a Social Security Number is valid * needs the first three digits and first two digits and the * final four digits as separate integer parameters * @param int $area 3-digit group in a SSN * @param int $group 2-digit group in a SSN * @param int $serial 4-digit group in a SSN * @param array $high_groups array of highest issued group numbers * area number=>group number */ function ssnCheck($ssnCheck, $group, $serial, &$high_groups) { if (is_array($ssnCheck)) { extract($ssnCheck); } // perform trivial checks // no field should contain all zeros if (!($area && $group && $serial)) { return false; } // check if this area has been assigned yet if (!($high_group = $high_groups[$area])) { return false; } $high_group_range = Validate_US::ssnGroupRange($high_group); $group_range = Validate_US::ssnGroupRange($group); // if the assigned range is higher than this group number, we're OK if ($high_group_range > $group_range) { return true; } else { // if the assigned range is lower than the group number, that's bad if ($high_group_range < $group_range) { return false; } else { // we must be in the same range, check the actual numbers if ($high_group >= $group) { return true; } else { return false; } } } }
<?php include "Validate/US.php"; $validate = new Validate_US(); echo $validate->phoneNumber("614-999-9999");