php 验证token合法性,验证token_是否合法的token,&是否超时的token180312

~~~

/*这里:http://im.gamebridge.cn/index.php/api18sof1cop2care/Inde1check2token/index/softid/1/token/aw3/toke02/15211403840.65084300

通过~验证:SoftId号, toke01(相当于password),和toke02,判断是否合法请求(合法应用);

并且顺便判断toke02是否超时,超时的话…就提示超时;

需要重新取

http://im.gamebridge.cn/index.php/api18sof1cop2care/index/index/softid/1/token/aw3/expire/2018-01-01

去重新取 toke02!

*/

//http://im.gamebridge.cn/index.php/api18sof1cop2care/Inde1check2token/index/softid/1/token/aw3/toke02/15211403840.65084300

namespace app\api18sof1cop2care\controller;

use think\Db;

use think\Request;

class Inde1check2token//class Index

{

/**

* @var \think\Request Request实例

*/

protected $request;

/**

* 构造方法

* @param Request $request Request对象

* @access public

*/

public function __construct(Request $request)

{

$this->request = $request;

}

public function index()

{

$softid001= Db::name('a1soft1copy2care') -> where('soft01id',$this->request->param('softid') )

->where('toke01', $this->request->param('token'))//->where( time() ,'request->param('expire02unixtimestam'))

->where('toke02', $this->request->param('toke02') )

->find();

//dump($softid001);

if (empty($softid001) ) {echo 'false1'; return 'false';}//给定的参数:软件id和 token参数,如果找不到(或者不对),那么就出错(返回)

$now01time= strtotime(date('Y-d-m H:i:s')) ;

list($toke00time, $toke002)= explode( "." , $this->request->param('toke02') );

if ( ( $now01time- 3600) > $toke00time ) {echo 'toke02 out time!超时!'; return 'false';}

return 'true'.$toke00time;//sec1usec;;//true;

//return $this->request->param('n');

}//public function index()

}//class Index

~~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值