当前位置: 首页>>代码示例>>PHP>>正文


PHP Authentication::validate方法代码示例

本文整理汇总了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;
 }
开发者ID:nepa,项目名称:sotc-rest-api,代码行数:26,代码来源:DeviceInfosController.php

示例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);
开发者ID:rockerest,项目名称:capstone,代码行数:31,代码来源:Login.php

示例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;
 }
开发者ID:nepa,项目名称:sotc-rest-api,代码行数:33,代码来源:SoundSamplesController.php

示例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;
 }
开发者ID:nepa,项目名称:sotc-rest-api,代码行数:30,代码来源:NoiseLevelsController.php

示例5: test

function test($name, $key)
{
    echo '<br />Is ' . (Authentication::validate($name, $key) === false ? 'NOT' : '') . ' a valid combination: ' . $name . ' / ' . $key;
}
开发者ID:nepa,项目名称:Server-One,代码行数:4,代码来源:authTest.php


注:本文中的Authentication::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。