本文整理汇总了PHP中Fn::crypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Fn::crypt方法的具体用法?PHP Fn::crypt怎么用?PHP Fn::crypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fn
的用法示例。
在下文中一共展示了Fn::crypt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdatePwd
public function actionUpdatePwd()
{
$response = array();
$user_phone = $this->request->getParam('user_phone');
$new_pwd = trim($this->request->getParam('new_pwd'));
$phone_code = trim($this->request->getParam('phone_code'));
$verifyCode = FCookie::get(FConfig::item('config.cookie.phone_key'));
$verifyCode = Fn::crypt($verifyCode, FConfig::item('config.cookie.phone_code'), 'decode');
if ($phone_code != $verifyCode) {
$response['status'] = 100001;
$response['content'] = '短信验证失败!';
} else {
$res = $this->user_model->updateAll(array('password' => md5($new_pwd)), 'phone_num=:phone', array(':phone' => $user_phone));
if ($res) {
$response['status'] = 100000;
$response['content'] = '修改密码成功!';
} else {
$response['status'] = 100002;
$response['content'] = '修改密码失败!';
}
}
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
示例2: actionSendMsgPhone
public function actionSendMsgPhone()
{
$sendMessage = new SendMessage();
$response = array();
$code = FHelper::generate_code();
$content = FConfig::item('siteMessage.register.first') . $code . FConfig::item('siteMessage.register.end');
$user = FConfig::item('config.ws_mobile.userName');
$pass = FConfig::item('config.ws_mobile.passWord');
$today = date('Y-m-d 0:0:0', time());
$condition = array('condition' => "mobile_no = '{$this->user['phone_num']}' and send_time >= '{$today}'");
$messageCount = $sendMessage->count($condition);
if ($messageCount < 5) {
Yii::import('ext.wsMobile.ws.*');
require_once 'ws-demo.php';
$engine = WS_SDK::getInstance($user, $pass);
$res = $engine->sendSmsAsNormal($this->user['phone_num'], $content, '', 0);
if (intval($res) === 0) {
$cryRes = Fn::crypt($code, FConfig::item('config.cookie.phone_code'));
FCookie::set(FConfig::item('config.cookie.phone_key'), $cryRes);
$response['status'] = 100000;
$response['content'] = '短信发送成功';
$telArr = array('mobile_no' => $this->user['phone_num'], 'mess_code' => $code, 'send_time' => FF_DATE_TIME);
$sendMessage->attributes = $telArr;
$sendMessage->save();
} else {
$response['status'] = 100001;
$response['content'] = '短信发送失败,请重试';
}
} else {
$response['status'] = 100002;
$response['content'] = '该手机号码今天发送验证码过多';
}
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}