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


PHP get_username函数代码示例

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


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

示例1: autoLogin

 /**
  * 自动登录用户
  * @param  integer $user 用户信息数组
  */
 private function autoLogin($user, $remember = false)
 {
     /* 更新登录信息 */
     $data = array('uid' => $user['uid'], 'login' => array('exp', '`login`+1'), 'last_login_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1));
     $this->save($data);
     /* 记录登录SESSION和COOKIES */
     $auth = array('uid' => $user['uid'], 'username' => get_username($user['uid']), 'last_login_time' => $user['last_login_time']);
     session('user_auth', $auth);
     session('user_auth_sign', data_auth_sign($auth));
     if ($remember) {
         $token = build_auth_key();
         $user1 = D('user_token')->where('uid=' . $user['uid'])->find();
         $data1['token'] = $token;
         $data1['time'] = time();
         if ($user1 == null) {
             $data1['uid'] = $user['uid'];
             D('user_token')->add($data1);
         } else {
             D('user_token')->where('uid=' . $user['uid'])->save($data1);
         }
     }
     if (!$this->getCookieUid() && $remember) {
         $expire = 3600 * 24 * 7;
         cookie('ZS_LOGGED_USER', $this->jiami($this->change() . ".{$user['uid']}.{$token}"), $expire);
     }
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:30,代码来源:MemberModel.class.php

示例2: login

 /**
  * 用户登录认证
  * @param  string  $username 用户名
  * @param  string  $password 用户密码
  * @param  integer $type     用户名类型 (1-用户名,2-邮箱,3-手机,4-UID)
  * @return integer           登录成功-用户ID,登录失败-错误编号
  */
 public function login($username, $password, $type = 1)
 {
     if (file_exists('./api/uc_login.lock')) {
         include_once './api/uc_client/client.php';
         if (strtolower(UC_CHARSET) == 'gbk') {
             $username = iconv('UTF-8', 'GBK', $username);
         }
         $uc_user = uc_user_login($username, $password, 0);
         if ($uc_user[0] == -2) {
             return '密码错误';
         } elseif ($uc_user[0] == -1) {
             return '用户不存在,或者被删除';
         } elseif ($uc_user[0] > 0) {
             if (strtolower(UC_CHARSET) == 'gbk') {
                 $uc_user[1] = iconv('GBK', 'UTF-8', $uc_user[1]);
             }
             D('member')->where(array('uid' => $uc_user[0]))->setField('nickname', $uc_user[1]);
             D('ucenter_member')->where(array('id' => $uc_user[0]))->setField('username', $uc_user[1]);
             return $uc_user[0];
         }
     } else {
         if (UC_SYNC && $username != get_username(1)) {
             return $this->ucLogin($username, $password);
         }
         return $this->model->login($username, $password, $type);
     }
 }
开发者ID:admpub,项目名称:OpenCenter,代码行数:34,代码来源:UserApi.class.php

示例3: get_status_list

function get_status_list($target = null)
{
    $states = array();
    $result = '';
    $target = isset($target) ? $target : get_username();
    // Default to showing own status.
    $statuses = getStatus($target);
    $health = getHealth($target);
    if ($health < 1) {
        $states[] = "Dead";
    } else {
        // *** Other statuses only display if not dead.
        if ($health < 80) {
            $states[] = "Injured";
        } else {
            $states[] = "Healthy";
        }
        if ($statuses['Stealth']) {
            $states[] = "Stealthed";
        }
        if ($statuses['Poison']) {
            $states[] = "Poisoned";
        }
        if ($statuses['Frozen']) {
            $states[] = "Frozen";
        }
    }
    return $states;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:29,代码来源:lib_status.php

示例4: index

 function index()
 {
     $this->load->model('twitter_model');
     if (get_username() == $this->config->item('default_user')) {
         /*
         			$this->load->library('postmark');
         			$query = $this->db->query("SELECT username, email FROM user");
         			foreach ($query->result() as $row) {
         				$this->postmark->clear();
         				$this->postmark->from('stephen@oneextralap.com', 'Stephen Ou');
         				$this->postmark->to($row->email);
         				$this->postmark->subject('Some updates from OneExtraLap HQ');
         				$this->postmark->message_html('Hello, there,<br /><br />Sorry to bug you, but I have some great things to tell you. :)<br /><br />First, I released some really cool features earlier this week, including view grades, edit tags, and more. Also our landing page has a featured user list. If you want to be stood out, participate as much as possible! More info: http://oneextralap.tumblr.com/post/965814476<br /><br />Second, I want to give you the privilege to invite friends to the site, your invite link is http://oneextralap.com/refer/'.$row->username.'. There are awards for it too, 3 new users = Promotion Ambassador badge!<br /><br />Lastly, I made a handy survey.io feedback form for your guys, because I want to know your opinions about OneExtraLap and help us grow together! http://survey.io/survey/99b06<br /><br />Stephen,<br />Founder of OneExtraLap<br />http://oneextralap.com');
         				$this->postmark->send();
         				echo $row->email.' '.$row->code.'<br />';
         			}
         			$query = $this->db->query("SELECT answer_id FROM activity");
         			foreach ($query->result() as $row) {
         				$row1 = $this->db->query("SELECT question_id FROM answer WHERE id='$row->answer_id'")->row();
         				
         				$this->db->update('activity', array('question_id' => $row1->question_id), array('answer_id' => $row->answer_id));
         			}
         			$query = $this->db->query("SELECT username FROM user");
         			foreach ($query->result() as $row) {
         				$this->db->update('user', array('notification' => 1), array('username' => $username));
         			}
         			$query = $this->db->query("SELECT username FROM user WHERE avatar='http://www.gravatar.com/avatar'");
         			foreach ($query->result() as $row) {
         				$this->db->update('user', array('avatar' => 'http://www.gravatar.com/avatar/'), array('username' => $username));
         			}
         			$query = $this->db->query("SELECT username FROM user WHERE twitter!=''");
         			foreach ($query->result() as $row) {
         				$this->db->update('user', array('share_created' => 1, 'share_badge' => 1), array('username' => $username));
         			}
         $quiz = array('netspencer', 'stephenou', 'danielbru', 'hiten', 'crystalcy', 'imkevinxu', 'zacharycollins', 'markbao', 'powdahound', 'jp', 'andmurphoto', 'jakemates', 'mike3k');
         			$a = 0;
         			while ($a < count($quiz)) {
         				$this->db->insert('preset', array('content' => $quiz[$a], 'type' => 'people'));
         				$a++;
         			}
         		
         			
         			$query = $this->db->query("SELECT username, twitter, twitter_id FROM user WHERE twitter!='' AND twitter_id=0");
         			foreach ($query->result() as $row) {
         				$call = $this->twitter->call('users/show', array('screen_name' => $row->twitter));
         				$this->db->update('user', array('twitter_id' => $call->id), array('username' => $username));
         			}
         			
         			$query = $this->db->query("SELECT username FROM user");
         			foreach ($query->result() as $row) {
         				$this->badge_model->check($row->username, 'test');
         			}
         */
         /*
          */
     } else {
         stupid();
     }
 }
开发者ID:stephenou,项目名称:OneExtraLap,代码行数:59,代码来源:test.php

示例5: get_selected_courses

function get_selected_courses()
{
    $student = get_username();
    $courses = get_option($student . "_selected_courses");
    if (!$courses) {
        $courses = array();
    }
    return $courses;
}
开发者ID:HaThuy92,项目名称:hathithuy_quanlytinchi,代码行数:9,代码来源:course.php

示例6: get_user

function get_user()
{
    $CI =& get_instance();
    $username = get_username();
    if (!$username) {
        return FALSE;
    }
    return $CI->db->get_where('agent', array('name' => $username))->row_array();
}
开发者ID:sdgdsffdsfff,项目名称:raptor,代码行数:9,代码来源:user_helper.php

示例7: users_restricted

function users_restricted() {
  ssl_required();
  if( array_search(get_username(), AllowedUsers::$list) === False ) {
    // user not allowed to view this page
    // redirect to another page saying as much
    header('Location: ../error-page/?code=forbidden');
    die(0);
  }  
}
开发者ID:roycefu,项目名称:MIT-Mobile-Web,代码行数:9,代码来源:security.php

示例8: make_content

function make_content($row)
{
    global $tp;
    $contents = utf8_decode(stripslashes($tp->toHTML($row['page_content'], true, 'body')));
    include_once "Textile.php";
    $textile = new Textile();
    $contents = $textile->process($contents);
    return $contents . "<p><small>" . LAN_W_8 . " <a href='" . e_HTTP . "user.php?id." . $row['page_author'] . "'>" . get_username($row['page_author']) . "</a></small></p>";
}
开发者ID:alcides,项目名称:e107wiki,代码行数:9,代码来源:templates.php

示例9: lists

 public function lists()
 {
     $list = $this->item->select();
     foreach ($list as $k => $v) {
         $list[$k]['username'] = get_username($v['uid']);
         $list[$k]['itemtype'] = $this->itemCate->where(array('id' => $v['itemtype']))->getField('catename');
     }
     $this->list = $list;
     $this->display();
 }
开发者ID:xiqingongzi,项目名称:kidvoodoo,代码行数:10,代码来源:ItemController.class.php

示例10: autoLogin

 /**
  * 自动登录用户
  * @param  integer $user 用户信息数组
  */
 private function autoLogin($user)
 {
     /* 更新登录信息 */
     $data = array('uid' => $user['uid'], 'login' => array('exp', '`login`+1'), 'last_login_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1));
     $this->save($data);
     /* 记录登录SESSION和COOKIES */
     $auth = array('uid' => $user['uid'], 'username' => get_username($user['uid']), 'last_login_time' => $user['last_login_time']);
     session('user_auth', $auth);
     session('user_auth_sign', data_auth_sign($auth));
 }
开发者ID:fengyeno,项目名称:fille,代码行数:14,代码来源:MemberModel.class.php

示例11: get_session_username

 function get_session_username($session_id)
 {
     $session_id = preg_replace('/\\W/', '', $session_id);
     $user_id = Token::is_valid($session_id);
     if (!empty($user_id)) {
         return get_username($user_id);
     } else {
         return null;
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:10,代码来源:studip_session.php

示例12: create_banlist

/**
 * create_banlist()
 *
 * @return
 **/
function create_banlist()
{
    global $CONFIG, $lang_banning_php, $album_date_fmt;
    //$PHP_SELF,
    $result = cpg_db_query("SELECT *, UNIX_TIMESTAMP(expiry) AS expiry FROM {$CONFIG['TABLE_BANNED']} WHERE brute_force=0");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        echo <<<EOHEAD
                <tr>
                <th align="center" class="tableh2">{$lang_banning_php['user_name']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['ip_address']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['expiry']}</th>
                <th align="center" class="tableh2"></th>
                </tr>
EOHEAD;
        $row_counter = 0;
        while ($row = mysql_fetch_array($result)) {
            if ($row['user_id']) {
                $username = get_username($row['user_id']);
            } else {
                $username = '';
            }
            if ($row['expiry']) {
                $expiry = localised_date($row['expiry'], '%Y-%m-%d');
            } else {
                $expiry = '';
            }
            echo <<<EOROW
                                        <tr>
                                               <form action="{$_SERVER['PHP_SELF']}" method="post" name="banlist{$row_counter}">
                                                     <td width="20%" class="tableb" valign="middle">
                                                             <input type="hidden" name="ban_id" value="{$row['ban_id']}" />
                                                <input type="text" class="textinput" style="width: 100%" name="edit_ban_user_name" value="{$username}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="textinput" size="15" name="edit_ban_ip_addr" value="{$row['ip_addr']}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="listbox_lang" size="20" name="edit_ban_expires" value="{$expiry}" readonly="readonly" title="{$lang_banning_php['select_date']}" />
                                                <a href="javascript:;"  onclick="return getCalendar(document.banlist{$row_counter}.edit_ban_expires);" title="{$lang_banning_php['select_date']}"><img src="images/calendar.gif" width="16" height="16" border="0" alt="" /></a>
                                        </td>
                                        <td class="tableb" valign="middle">
                                                                <input type="submit" class="button" name="edit_ban" value="{$lang_banning_php['edit_ban']}" />
                                        &nbsp;&nbsp;
                                                                <input type="submit" class="button" name="delete_ban" value="{$lang_banning_php['delete_ban']}" />
                                        </td>
                                </form>
                                </tr>
EOROW;
            $row_counter++;
        }
    }
    mysql_free_result($result);
}
开发者ID:alencarmo,项目名称:OCF,代码行数:59,代码来源:banning.php

示例13: autoLogin

 /**
  * 自动登录用户
  * @param  integer $user 用户信息数组
  */
 private function autoLogin($user)
 {
     /* 更新登录信息 */
     $data = array("uid" => $user["uid"], "login" => array("exp", "`login`+1"), "last_login_time" => NOW_TIME, "last_login_ip" => get_client_ip(1));
     $this->save($data);
     /* 记录登录SESSION和COOKIES */
     $auth = array("uid" => $user["uid"], "username" => get_username($user["uid"]), "last_login_time" => $user["last_login_time"]);
     session("user_auth", $auth);
     session("uid", $auth["uid"]);
     session("user_auth_sign", data_auth_sign($auth));
 }
开发者ID:a1357479,项目名称:techan,代码行数:15,代码来源:MemberModel.class.php

示例14: index

 public function index()
 {
     if (!is_login()) {
         $this->error("您还没有登陆", U("User/login"));
     }
     $uid = is_login();
     $address = M("address");
     $list = $address->where("uid='{$uid}'")->select();
     $this->assign('list', $list);
     $this->meta_title = get_username() . '的地址管理';
     $this->display();
 }
开发者ID:gitchenze,项目名称:soloshop,代码行数:12,代码来源:AddressController.class.php

示例15: article

 public function article()
 {
     $Blogs = D('Article');
     $blog = $Blogs->where(array('status' => 1))->getField('id,title,description,create_time,uid');
     $RssConf = array('channelTitle' => 'zswin社交类博客', 'channelLink' => 'http://zswin.cn', 'channelDescrīption' => 'zswin开源博客', 'copyright' => 'zswin');
     $RSS = new Rss($RssConf);
     foreach ($blog as $k => $v) {
         $RSS->AddItem($v['title'], CSU('/artc/' . $v['id'], 'Index/artc', array('id' => $v['id'])), $v['description'], toDate($v['create_time']), $v['id'], get_username($v['uid']));
     }
     $RSS->SaveToFile("./rss.xml");
     echo $RSS->Show();
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:12,代码来源:RssController.class.php


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