<? $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'); } } ?>
<? if (p('func') == 'authenticate') { $u = p('schlage_username'); $p = p('schlage_password'); if ($u && $p) { $schlage = new Schlage($u, $p); if (!$schlage->Login()) { error('Invalid login, try again'); } else { schlage_username($u); schlage_password($p); success('Good to go!'); s('logged_in', 1); r('/users'); } } } top(); form(); func('authenticate'); label('Username'); textfield('schlage_username'); label('Password'); textfield('schlage_password'); label(); submit('Authenticate');