本文整理汇总了PHP中Authentication::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::validate方法的具体用法?PHP Authentication::validate怎么用?PHP Authentication::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication::validate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reportDeviceInformation
/**
* Validate the client's API key, store reported device information
* in the database and return a success message.
*
* \param $request REST request from client
*
* \return Array with response data
*/
private function reportDeviceInformation($request)
{
$result = array();
$bodyData = $request->getBodyData();
$arguments = $request->getURLArguments();
// Validate client credentials
if (isset($bodyData['AppName']) && isset($bodyData['ApiKey']) && Authentication::validate($bodyData['AppName'], $bodyData['ApiKey'])) {
// Report device information
if (isset($bodyData['OSVersion']) && isset($bodyData['APILevel']) && isset($bodyData['DeviceType']) && isset($bodyData['ReportedBy'])) {
$result = MediaServer::handleReportDeviceInfoRequest($bodyData['OSVersion'], $bodyData['APILevel'], $bodyData['DeviceType'], $bodyData['ReportedBy']);
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or incomplete request. Check URL arguments and body data.');
}
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or no auth data provided. Check your API key.');
}
return $result;
}
示例2: isset
$password = isset($_POST['pass']) ? $_POST['pass'] : null;
$identity = isset($_POST['email']) ? $_POST['email'] : null;
$fname = isset($_POST['fname']) ? $_POST['fname'] : null;
$lname = isset($_POST['lname']) ? $_POST['lname'] : null;
$identity = isset($_POST['email']) ? $_POST['email'] : null;
$ident_conf = isset($_POST['email_confirm']) ? $_POST['email_confirm'] : null;
$password = isset($_POST['pass']) ? $_POST['pass'] : null;
$pass_conf = isset($_POST['pass_confirm']) ? $_POST['pass_confirm'] : null;
$role = isset($_POST['register_role']) ? $_POST['register_role'] : 3;
if( $action == 'login' )
{
if( $password != null && $identity != null )
{
$tmp = Authentication::validate($identity, $password);
if( $tmp )
{
setSessionVar('active', true);
setSessionVar('fname', $tmp->fname);
setSessionVar('lname', $tmp->lname);
setSessionVar('roleid', $tmp->authentication->role->roleid);
setSessionVar('userid', $tmp->userid);
setSessionVar('isAnon', false);
kick(2, null, 0 );
}
else
{
kick(0, array('identity' => $identity), 1);
示例3: uploadSoundSample
/**
* Validate the client's API key, save uploaded sound sample on
* disk and return a success message.
*
* \param $request REST request from client
*
* \return Array with response data
*/
private function uploadSoundSample($request)
{
$result = array();
$bodyData = $request->getBodyData();
$arguments = $request->getURLArguments();
// Validate client credentials
if (isset($bodyData['AppName']) && isset($bodyData['ApiKey']) && Authentication::validate($bodyData['AppName'], $bodyData['ApiKey'])) {
// Upload sound sample
if (isset($arguments['latitude']) && isset($arguments['longitude']) && isset($bodyData['Time']) && isset($bodyData['Tag']) && isset($bodyData['PayloadType']) && isset($bodyData['Payload']) && isset($bodyData['ReportedBy'])) {
// Prevent PHP notice because of undefined index
if (!isset($bodyData['Title'])) {
$bodyData['Title'] = null;
}
if (!isset($bodyData['Description'])) {
$bodyData['Description'] = null;
}
$result = MediaServer::handleUploadRequest($arguments['latitude'], $arguments['longitude'], $bodyData['Title'], $bodyData['Time'], $bodyData['Description'], $bodyData['Tag'], $bodyData['PayloadType'], $bodyData['Payload'], $bodyData['ReportedBy']);
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or incomplete request. Check URL arguments and body data.');
}
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or no auth data provided. Check your API key.');
}
return $result;
}
示例4: reportNoiseLevel
/**
* Validate the client's API key, store reported noise level
* value in the database and return a success message.
*
* \param $request REST request from client
*
* \return Array with response data
*/
private function reportNoiseLevel($request)
{
$result = array();
$bodyData = $request->getBodyData();
$arguments = $request->getURLArguments();
// Validate client credentials
if (isset($bodyData['AppName']) && isset($bodyData['ApiKey']) && Authentication::validate($bodyData['AppName'], $bodyData['ApiKey'])) {
// Report noise level
if (isset($arguments['latitude']) && isset($arguments['longitude']) && isset($bodyData['Time']) && isset($bodyData['NoiseLevel']) && isset($bodyData['NoiseLevelOrg']) && isset($bodyData['ReportedBy']) && isset($bodyData['InPocket'])) {
// Prevent PHP notice because of undefined index
if (!isset($arguments['zipCode'])) {
$arguments['zipCode'] = null;
}
$result = MediaServer::handleReportRequest($arguments['latitude'], $arguments['longitude'], $bodyData['Time'], $arguments['zipCode'], $bodyData['NoiseLevel'], $bodyData['NoiseLevelOrg'], $bodyData['ReportedBy'], $bodyData['InPocket']);
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or incomplete request. Check URL arguments and body data.');
}
} else {
$result = array('Statuscode' => 'Error', 'Message' => 'Invalid or no auth data provided. Check your API key.');
}
return $result;
}
示例5: test
function test($name, $key)
{
echo '<br />Is ' . (Authentication::validate($name, $key) === false ? 'NOT' : '') . ' a valid combination: ' . $name . ' / ' . $key;
}