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


PHP Session_start函数代码示例

本文整理汇总了PHP中Session_start函数的典型用法代码示例。如果您正苦于以下问题:PHP Session_start函数的具体用法?PHP Session_start怎么用?PHP Session_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Session_start函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 public function login()
 {
     Session_start();
     $builder = new CaptchaBuilder();
     $builder->build();
     $phrase = $builder->getPhrase();
     $_SESSION['phrase'] = $phrase;
     return View::make('login')->with(array('captcha' => $builder, 'links' => $this->link()));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:9,代码来源:UserPageController.php

示例2: init

 public static function init()
 {
     // check for current session
     if (!self::get('session')) {
         //create session if non-existent, suppress errors.
         @Session_start();
         // set flag that session was created
         self::set('session', TRUE);
     }
 }
开发者ID:ChrisKoivu,项目名称:PhipMVC,代码行数:10,代码来源:Session.php

示例3: initialize

 public function initialize()
 {
     $CI =& get_instance();
     $num = "";
     for ($i = 0; $i < 4; $i++) {
         $num .= rand(0, 9);
     }
     Session_start();
     $_SESSION["Checknum"] = $num;
     $CI->load->library('session');
     $CI->session->set_userdata('Checknum', $num);
     echo $CI->session->userdata('Checknum');
     echo $_SESSION["Checknum"];
 }
开发者ID:miguelmeca,项目名称:wscat,代码行数:14,代码来源:Set.php

示例4: Session_start

<?php

Session_start();
if (!isset($_SESSION['tipo'])) {
    echo "<script language=\"javascript\">\n\t\t\t\t\talert(\"Inicie sesion primero\");\n\t\t\t\t\twindow.location.href = \"../index.php\"\n\t\t\t\t</script>";
} elseif ($_SESSION['tipo'] != 'd') {
    echo "<script language=\"javascript\">\n\t\t\t\t\talert(\"No tiene permisos!\");\n\t\t\t\t\twindow.location.href = \"../index.php\"\n\t\t\t\t</script>";
}
开发者ID:adrianloma,项目名称:RedCross,代码行数:8,代码来源:sessionAdmin.php

示例5: resendCheckCode

 public function resendCheckCode()
 {
     Session_start();
     $email = Input::get('email');
     //产生随机验证码发到邮箱
     $possible_charactors = "abcdefghijklmnopqrstuvwxyz0123456789";
     $salt = "";
     //验证码
     while (strlen($salt) < 6) {
         $salt .= substr($possible_charactors, rand(0, strlen($possible_charactors) - 1), 1);
     }
     //发送邮件
     Mail::send('emails/token', array('token' => $salt), function ($message) use($email) {
         $message->to($email, '')->subject('中国儿童戏剧教育网验证码!');
     });
     $_SESSION['registerSalt'] = $salt;
     return Response::json(array('errCode' => 0, 'message' => '验证码发送成功!'));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:18,代码来源:UserController.php

示例6: pwdReset

 public function pwdReset()
 {
     Session_start();
     $email = Input::get('email');
     $check_code = Input::get('check_code');
     $password = Input::get('password');
     // $re_password 		= Input::get('re_password');
     if ($email != Session::get('reset_email')) {
         return Response::json(array('errCode' => 1, 'message' => '邮箱不正确!'));
     }
     if ($check_code != Session::get('reset_code')) {
         return Response::json(array('errCode' => 2, 'message' => '验证码不正确!'));
     }
     if (strlen($password) < 6 || strlen($password) > 20) {
         return Response::json(array('errCode' => 3, 'message' => '密码长度为6到20之间!'));
     }
     // if($password != $re_password)
     // return Response::json(array('errCode'=>4, 'messsage' =>'两次输入的密码不一致!'));
     try {
         $user = Sentry::findUserByLogin($email);
         if ($user->checkResetPasswordCode($check_code)) {
             if ($user->attemptResetPassword($check_code, $password)) {
                 return Response::json(array('errCode' => 0, 'message' => '密码修改成功!'));
             } else {
                 return Response::json(array('errCode' => 5, 'message' => '密码修改失败!'));
             }
         } else {
             return Response::json(array('errCode' => 6, 'message' => '密码无效!'));
         }
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Response::json(array('errCode' => 7, 'message' => '用户不存在!'));
     }
     // $user = User::where('email', '=', $email)->first();
     // $user->password = Hash::make($password);
     // if(!$user->save())
     // 	return Response::json(array('errCode'=>5, 'message'=>'密码修改失败!'));
     // return Response::json(array('errCode'=>0, 'message'=>'密码修改成功!'));
 }
开发者ID:Jv-Juven,项目名称:gift,代码行数:38,代码来源:UserController.php

示例7: bSiteRegister

 public function bSiteRegister()
 {
     Session_start();
     // $captcha = Input::get('captcha');
     // if( $captcha != $_SESSION['phrase'])
     // 	return Response::json(array('errCode'=>8, 'message'=> '验证码不正确'));
     $data = array('login_account' => Input::get('login_account'), 'password' => Input::get('password'), 're_password' => Input::get('re_password'));
     $rules = array('login_account' => 'required|email|unique:users,login_account', 'password' => 'required|alpha_num|between:6,16', 're_password' => 'required|same:password');
     $messages = array('login_account.required' => 1, 'password.required' => 1, 're_password.required' => 1, 'login_account.unique' => 2, 'login_account.email' => 3, 'password.alpha_num' => 4, 'password.between' => 5, 're_password.same' => 6);
     $validation = Validator::make($data, $rules, $messages);
     if ($validation->fails()) {
         //获得错误信息数组
         $number = $validation->messages()->all();
         switch ($number[0]) {
             case 1:
                 return Response::json(array('errCode' => 1, 'message' => '信息填写不完整!'));
             case 2:
                 return Response::json(array('errCode' => 2, 'message' => '邮箱已被注册!'));
             case 3:
                 return Response::json(array('errCode' => 3, 'message' => '邮箱格式不正确!'));
             case 4:
                 return Response::json(array('errCode' => 4, 'message' => '密码只能包含字母和数字!'));
             case 5:
                 return Response::json(array('errCode' => 5, 'message' => '密码必须是6到20位之间!'));
             case 6:
                 return Response::json(array('errCode' => 6, 'message' => '两次密码输入不一致!'));
             default:
                 return Response::json(array());
         }
     } else {
         $token = md5($data['login_account'] . time());
         //发送邮件
         Mail::send('emails/token', array('token' => $token), function ($message) use($data) {
             $message->to($data['login_account'], '')->subject('车尚提醒您:请验证您的邮箱');
         });
         try {
             $user = Sentry::createUser(array('login_account' => $data['login_account'], 'password' => $data['password'], 'user_type' => 1, 'status' => 10));
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             return Response::json(array('errCode' => 7, 'message' => '该用户已存在'));
         }
         //储存数据
         $user = User::where('login_account', $user->login_account)->first();
         Sentry::login($user, false);
         Cache::put($token, $user, 1440);
         // var_dump($user->user_id);
         return Response::json(array('errCode' => 0, 'message' => '验证码发送成功!'));
     }
 }
开发者ID:Jv-Juven,项目名称:carService,代码行数:48,代码来源:UserController.php


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