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


PHP Current_User::user方法代码示例

本文整理汇总了PHP中Current_User::user方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::user方法的具体用法?PHP Current_User::user怎么用?PHP Current_User::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Current_User的用法示例。


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

示例1: index

 public function index()
 {
     if ($user = Current_User::user()) {
         redirect("inicio");
     }
     $data["content"] = "home";
     $this->load->view("index", $data);
 }
开发者ID:pam81,项目名称:pack,代码行数:8,代码来源:home.php

示例2: index

 public function index()
 {
     if (Current_User::user()) {
         if (!empty($_GET['logoff'])) {
             $this->logout();
             header("location:login.html");
         } else {
             include 'admin_registration.view.php';
             // @ session already active
             //		    $arr = array('status' => true, 'message' => $ACL_LANG['SESSION_ACTIVE'], 'url' => SUCCESS_URL);
             //        $json_arr = json_encode($arr);
             //        echo $json_arr;
         }
     } else {
         // load data to the view if there are some data needed
         //include('login.view.php');
         //@ session not active
         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
             //@ first load
             $arr = array('status' => false, 'message' => $acl->form());
             $json_arr = json_encode($arr);
             echo $json_arr;
         } else {
             //@ form submission
             $u = !empty($_POST['u']) ? trim($_POST['u']) : false;
             // retrive user var
             $p = !empty($_POST['p']) ? trim($_POST['p']) : false;
             // retrive password var
             // @ try to signin
             $is_auth = Current_User::authenticate($u, $p);
             if ($is_auth) {
                 //@ success
                 $arr = array('status' => true, 'message' => $ACL_LANG['LOGIN_SUCCESS'], 'url' => SUCCESS_URL);
                 $json_arr = json_encode($arr);
                 echo $json_arr;
             } else {
                 //@ failed
                 $arr = array('status' => false, 'message' => $ACL_LANG['LOGIN_FAILED']);
                 $json_arr = json_encode($arr);
                 echo $json_arr;
             }
         }
     }
 }
开发者ID:laiello,项目名称:neologism,代码行数:44,代码来源:user.controller.php

示例3: authenticate

 /**
  * Authenticate and validate the user.
  * @param $username
  * @param $password
  * @return unknown_type
  */
 public static function authenticate($username, $password)
 {
     global $db_config;
     $result = FALSE;
     $db = NULL;
     if ($username && $password) {
         $db = @mysql_connect($db_config['server'], $db_config['user'], $db_config['pass']);
         if (!$db) {
             return FALSE;
         }
         $opendb = @mysql_select_db($db_config['name'], $db);
         if (!$opendb) {
             return FALSE;
         }
         $sql = "SELECT * FROM " . $db_config['users'] . " WHERE ";
         switch (LOGIN_METHOD) {
             case 'both':
                 $sql .= "(username='" . mysql_real_escape_string($username) . "' OR useremail='" . mysql_real_escape_string($username) . "')";
                 break;
             case 'email':
                 $sql .= "useremail='" . mysql_real_escape_string($username) . "'";
                 break;
             default:
                 $sql .= "username='" . mysql_real_escape_string($username) . "'";
                 break;
         }
         $sql .= " AND userpassword = '" . md5($password) . "'";
         $rs = @mysql_query($sql, $db);
         if (!$rs) {
             return FALSE;
         }
         if (mysql_num_rows($rs)) {
             $u = new stdClass();
             //$u->user_id
             self::$user = $u;
             self::setSession(array_merge(mysql_fetch_assoc($rs), array('expires' => time() + 45 * 60)));
             $result = TRUE;
         }
         mysql_free_result($rs);
         mysql_close($db);
         unset($rs, $sql);
     }
     return $result;
 }
开发者ID:laiello,项目名称:neologism,代码行数:50,代码来源:current_user.model.php

示例4: login

 public static function login($username, $password)
 {
     $CI =& get_instance();
     $sql = "select * from admusers where active=1 and username='" . $CI->db->escape_str($username) . "'";
     $query = $CI->db->query($sql);
     $u = $query->result();
     if (isset($u[0])) {
         $CI->load->model("user_model");
         // password match (comparing encrypted passwords)
         if ($u[0]->password == $CI->user_model->transform_password($password)) {
             //$CI =& get_instance();
             $CI->load->library('session');
             $CI->session->set_userdata('user_id', $u[0]->id);
             self::$user = $u[0];
             return TRUE;
         }
     }
     // login failed
     return FALSE;
 }
开发者ID:pam81,项目名称:pack,代码行数:20,代码来源:current_user.php

示例5: login

 public static function login($username, $password)
 {
     // get User object by username
     if ($u = Doctrine::getTable('User')->findOneByUsername($username)) {
         // this mutates (encrypts) the input password
         $u_input = new User();
         $u_input->password = $password;
         // password match (comparing encrypted passwords)
         if ($u->password == $u_input->password) {
             unset($u_input);
             $CI =& get_instance();
             $CI->session->set_userdata('user_id', $u->id);
             self::$user = $u;
             return TRUE;
         }
         unset($u_input);
     }
     // login failed
     return FALSE;
 }
开发者ID:voltxion,项目名称:Project-Urza,代码行数:20,代码来源:current_user.php

示例6: login

 public static function login($username, $password)
 {
     // get User object by username
     if ($u = Doctrine::getTable('User')->findOneByUsername($username)) {
         // to ge the mutated version of the input password
         $u_input = new User();
         $u_input->password = $password;
         // password match
         if ($u->password == $u_input->password && $u->status == 1) {
             unset($u_input);
             $CI =& get_instance();
             $CI->load->library('session');
             $CI->session->set_userdata('user_id', $u->id);
             self::$user = $u;
             return TRUE;
         }
         unset($u_input);
     }
     // login failed
     return FALSE;
 }
开发者ID:HCMPKenya,项目名称:HCMP-ALPHA,代码行数:21,代码来源:current_user.php

示例7: base_url

	<title>Home</title>
	<link rel="stylesheet" href="<?php 
echo base_url();
?>
css/style.css"
		type="text/css" media="all">
</head>
<body>

<div>

	<?php 
if (Current_User::user()) {
    ?>
		<h1>Hello <em><?php 
    echo Current_User::user()->username;
    ?>
</em>.</h1>
		<h3><?php 
    echo anchor('logout', 'Logout');
    ?>
</h3>		
	<?php 
} else {
    ?>
		<h2>New Users: <?php 
    echo anchor('signup', 'Create an Account');
    ?>
.</h2>
		<h2>Members: <?php 
    echo anchor('login', 'Login');
开发者ID:slugmandrew,项目名称:ci_doctrine,代码行数:31,代码来源:home.php

示例8: anchor

?>
/js/behaviour.js"></script>
</head>
<body>
	<!--[if !IE]>start wrapper<![endif]-->
	<div id="wrapper">
		<!--[if !IE]>start head<![endif]-->
		<div id="head">
			<div class="inner">
				<h1 id="logo"><a href="#">Voltxion</a></h1>
				<!--[if !IE]>start user details<![endif]-->
                                <br />
                                        <ul id="user_details_menu">
                                            
                                            <?php 
if ($user = Current_User::user()) {
    ?>
                                            <li class="first">Welcome <strong><?php 
    echo $user->username;
    ?>
</strong></li>
                                            <li><a href="#">My Account</a></li>
                                            <li class="last"><?php 
    echo anchor('logout', 'Logout');
    ?>
</li>
					<?php 
} else {
    ?>
                                            <li><?php 
    echo anchor('login', 'Login');
开发者ID:voltxion,项目名称:Project-Urza,代码行数:31,代码来源:header.php

示例9: verified_login

 public static function verified_login()
 {
     if (!($user = Current_User::user())) {
         redirect('home');
     }
 }
开发者ID:pam81,项目名称:pack,代码行数:6,代码来源:user_model.php

示例10: addnew

 public function addnew()
 {
     if ($this->_submit_validateUsuario() === FALSE) {
         $this->add();
         return;
     } else {
         $usuario = Current_User::user();
         $record = array('name' => $this->input->post("name"), 'lastname' => $this->input->post("lastname"), 'username' => $this->input->post("username"), 'password' => User_model::transform_password($this->input->post("password")), 'date_created' => date("Ymd"), 'created_by' => $usuario->username);
         $this->db->insert("admusers", $record);
         $this->addpermisos($this->db->insert_id());
         redirect("usuario/addSuccess");
     }
     redirect("usuario");
 }
开发者ID:pam81,项目名称:pack,代码行数:14,代码来源:usuario.php


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