本文整理汇总了PHP中Fn::getIp方法的典型用法代码示例。如果您正苦于以下问题:PHP Fn::getIp方法的具体用法?PHP Fn::getIp怎么用?PHP Fn::getIp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fn
的用法示例。
在下文中一共展示了Fn::getIp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGetRegister
/**
* 注册
*/
public function actionGetRegister()
{
$response = array();
$phone = trim($this->request->getParam('phone'));
$email = trim($this->request->getParam('email'));
$password = trim($this->request->getParam('password'));
$checkCode = trim($this->request->getParam('checkCode'));
$verifyMess = trim($this->request->getParam('verifyMess'));
$verifyCode = FCookie::get(FConfig::item('config.cookie.phone_key'));
$verifyCode = Fn::crypt($verifyCode, FConfig::item('config.cookie.phone_code'), 'decode');
if (!FHelper::FilterPhone($phone)) {
$response['status'] = 100003;
$response['content'] = '手机格式错误';
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
if (!$this->verifyPhone($phone)) {
$response['status'] = 100004;
$response['content'] = '手机号已经注册过了';
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
if (!FHelper::check_email($email)) {
$response['status'] = 100003;
$response['content'] = '邮箱格式错误';
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
if (!$this->verifyEmail($email)) {
$response['status'] = 100004;
$response['content'] = '邮箱帐号已经注册过了';
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
session_start();
if ($checkCode != $_SESSION['verify_code']) {
$response['status'] = 100004;
$response['content'] = '校验码输入有误';
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}
if ($verifyMess != $verifyCode) {
$response['status'] = 100002;
$response['content'] = '短信验证码验证失败';
} else {
$attr = array('source_type' => 1, 'phone_num' => $phone, 'email' => $email, 'nick_name' => $email, 'password' => md5($password), 'register_ip' => ip2long(Fn::getIp()), 'create_time' => FF_DATE_TIME, 'update_time' => FF_DATE_TIME);
$this->user_model->attributes = $attr;
if ($this->user_model->save() && $this->user_model->id) {
$attr = array('user_id' => $this->user_model->id);
$this->userInfo_model->attributes = $attr;
$this->userInfo_model->save();
$response['status'] = 100000;
$response['content'] = '注册成功';
$attr['uid'] = $this->user_model->id;
$this->user = $attr;
$this->saveCookie($this->user_model->id, $this->user_model->nick_name, 0);
$_SESSION['auth_login'] = 'true';
FCookie::del(FConfig::item('config.cookie.phone_key'));
unset($_SESSION['verify_code']);
} else {
$response['status'] = 100002;
$response['content'] = '注册失败';
}
}
Yii::app()->end(FHelper::json($response['content'], $response['status']));
}