コード例 #1
0
ファイル: sms.php プロジェクト: rishair/schlagelink-twilio
<?

$from = user(p('From'));

$message = '';
if ($from) {
	$schlage = Schlage::GetInstance();
	$schlage->Login();
	$locks = $schlage->GetLocks();
	$schlage->Activate($locks[0]);
	log_action($from, 'Activated Front Door [SMS]');
	incr_stat('authorized');
	incr_stat('authorized_sms');
} else {
	if (p('From')) {
		log_action(p('From'), 'Unauthorized [SMS]');
		incr_stat('unauthorized');
		incr_stat('unauthorized_sms');
	}
}

?>
コード例 #2
0
ファイル: call.php プロジェクト: rishair/schlagelink-twilio
<? echo '<?xml version="1.0" encoding="UTF-8" ?> '; ?> <?

$from = user(p('From'));
$message = '';
if (!$from) {
	$message = 'Who do you think you are?';
	log_action(p('From'), 'Unauthorized [DIAL]');
	incr_stat('unauthorized');
	incr_stat('unauthorized_dial');
} else {
	$user = explode(' ', $from['name']);
	$user = $user[0];
	$message = 'Welcome back ' . $user;
	$schlage = Schlage::GetInstance();
	$schlage->Login();
	$locks = $schlage->GetLocks();
	$schlage->Activate($locks[0]);
	log_action($from, 'Activated Front Door [DIAL]');
	incr_stat('authorized');
	incr_stat('authorized_dial');
}

?>

<Response> 
    <Say voice="man"><?php 
echo $message;
?>
</Say>
</Response>