Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as PHP by dg ( 16 years ago )
function GetUserPhone($userid){
global $db;
$Env = Environment::getInstance();
$phoneinfo = array();
if(!is_string($userid) or !$userid) { trigger_error("Invalid parameter \$UserID in user::getData()", E_USER_ERROR); return false; }
$userphone = $db->all("SELECT qcname, data FROM ".USERPROFILESDATATABLE." WHERE user='".$userid."' and (qcname = 'phone' or qcname = 'mobile')");
if($userphone) {
foreach($userphone as $fetch) {
$userphone[$fetch["qcname"]] = $fetch["data"];
}
}
preg_match('/\((\d+)\)(\d+)\-(\d+)\-(\d+)/', $userphone['phone'], $matches);
if (isset($matches[1]) && isset($matches[2]) && isset($matches[3]) && isset($matches[4])) {
for($i = 1; $i <= 4; ++$i) {
$phoneinfo['phone' . $i] = $matches[$i];
}
} else {
$phoneinfo['phone1'] = '017';
}
preg_match('/(\d+)\-(\d+)\-(\d+)\-(\d+)\-(\d+)/', $userphone['mobile'], $matches);
if (isset($matches[1]) && isset($matches[2]) && isset($matches[3])
&& isset($matches[4]) && isset($matches[5]))
{
for($i = 1; $i <= 5; ++$i) {
$phoneinfo['mobile' . $i] = $matches[$i];
}
} else {
$phoneinfo['mobile1'] = '8';
$phoneinfo['mobile2'] = '029';
}
Revise this Paste
Parent: 19805