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


PHP get_user_by_id函数代码示例

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


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

示例1: admin_order_index

function admin_order_index()
{
    $pagination = pagination(15, 'orders');
    $subject_index = '<table class="table table-hover table-bordered">';
    $subject_index .= '<tr><th>Order #</th><th>Order by</th><th>Order Total</th><th>Status</th><th>Modification</th></tr>';
    while ($subject = mysql_fetch_array($pagination['query'])) {
        $subject_index .= '<tr>';
        $subject_index .= '<td>' . $subject['id'] . '</td>';
        // get user name by its id !
        $order_by = get_user_by_id($subject['user_id']);
        $subject_index .= '<td>' . $order_by['username'] . '</td>';
        $subject_index .= '<td style="color: green;">$' . $subject['order_total'] . '</td>';
        if ($subject['status'] == 1) {
            $subject_index .= '<td style="color: red;">Recieved</td>';
        } elseif ($subject['status'] == 2) {
            $subject_index .= '<td style="color: orange;">Process</td>';
        } elseif ($subject['status'] == 3) {
            $subject_index .= '<td style="color: green;">Completed</td>';
        } else {
            $subject_index .= '<td>No Status !</td>';
        }
        $subject_index .= '<td><a href="' . site_options('link') . 'admin/edit_order.php?order=' . $subject['id'] . '">Details </a>';
        $alert = "'Are you sure you want to delete this page?'";
        $subject_index .= '/&nbsp;<a href="' . site_options('link') . 'admin/delete_order.php?order=' . $subject['id'] . '" onclick="return confirm(' . $alert . ');">Delete</a></td>';
        $subject_index .= '</tr>';
    }
    $subject_index .= '</table>';
    $subject_index .= $pagination['index'];
    return $subject_index;
}
开发者ID:kas5986,项目名称:simpleEcommerce,代码行数:30,代码来源:order_functions.php

示例2: get_user_permissions

 /**
  * Get User Permissions
  *
  * Allows you to get all permissions user has based
  * on their user ID
  *
  * @access public
  * @param $user_id
  * @return array
  *
  */
 public function get_user_permissions($user_id)
 {
     $user = get_user_by_id($user_id);
     if ($user) {
         $this->db->select('' . $this->db->dbprefix . 'permissions.permission_string AS permission');
         $this->db->where('' . $this->db->dbprefix . 'permissions_roles.role_id', $user->row('role_id'));
         $this->db->join('' . $this->db->dbprefix . 'permissions_roles', '' . $this->db->dbprefix . 'permissions_roles.permission_id = ' . $this->db->dbprefix . 'permissions.permission_id');
         $permissions = $this->db->get('permissions');
         return $permissions->num_rows() >= 1 ? $permissions->result_array() : array();
     }
     return FALSE;
 }
开发者ID:jelek92,项目名称:Zebra,代码行数:23,代码来源:Wolfauth_permissions_m.php

示例3: calculate_average_submissions

 /**
  * Calculate Average Submissions
  * 
  * Calculates a users average submission score
  * 
  * @param int $user_id
  * 
  */
 public function calculate_average_submissions($user_id)
 {
     $user = get_user_by_id($user_id);
     if ($user) {
         $user_meta = $this->wolfauth->get_user_meta($user_id);
         $days = ceil(abs($user->row('register_date') - now()) / 86400);
         if (isset($user_meta->submissions)) {
             $submissions = $user_meta->submissions;
         } else {
             $submissions = 0;
         }
         $average = round($submissions / $days, 2);
         return $average;
     }
 }
开发者ID:jelek92,项目名称:Zebra,代码行数:23,代码来源:user_model.php

示例4: user_change_password

function user_change_password($userid, $old_password, $new_password)
{
    $user_entry = get_user_by_id($userid);
    $checksum = md5(md5($old_password) . $user_entry['salt']);
    if ($checksum == $user_entry['password']) {
        // valid old password, set new password
        $new_checksum = md5(md5($new_password) . $user_entry['salt']);
        $s = q("UPDATE user SET password = '" . clean_query($new_checksum) . "' WHERE userid = '" . clean_query($userid) . "' LIMIT 1;");
        if (a() > 0) {
            return true;
        }
        return false;
    } else {
        // invalid old password
        return false;
    }
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:17,代码来源:user.lib.php

示例5: send_password_reset_email

function send_password_reset_email($email)
{
    $login = get_login_by_email($email);
    $uid = $login["id"];
    $user = get_user_by_id($uid);
    if ($user) {
        $subject = "[GT Water Ski] Password Reset Request";
        $link = "http://www.DavidEsposito.info/gtwaterski/ChangePassword.php?email={$email}&key={$user->password}";
        $msg = '
A password reset request from the GT Waterski Scheduling website has been submitted. If you did not' . 'submit a request, you may ignore this message or contact an administrator of the site.<br /><br />

Please visit the following link to reset your password:<br />
&emsp;' . $link . '
<br /><br />
Feel free to contact the site administrators with any questions. Thanks,
<br /><br />
Georgia Tech Waterski Club
';
        return sendEmail($subject, $msg, $email, $email);
    }
    return 0;
}
开发者ID:googlecode-mirror,项目名称:tech-cs-ondemand,代码行数:22,代码来源:SendEmail.ini.php

示例6: create_job

function create_job($ticket, $values)
{
    $CI =& get_instance();
    $product = $ticket['product'];
    $to = $values['to'];
    $agent = get_user_by_id($ticket['agent']);
    $price = get_price($product['id'], $agent['level']);
    if (!change_credit($agent['id'], -$price, $ticket['number'])) {
        return 'INSUFFICIENT_BALANCE_FROM_AGENT';
    }
    if ($product['cate'] == 4) {
        $this->load->helper('user');
        $user = get_user();
        if (!$user) {
            return 'LOGIN_REQUIRED';
        }
        // hack self business here
        if ($product['subcate'] == 900) {
            // increase balance
            change_credit($user['id'], $product['norm_value'], $ticket['number']);
        }
        if ($product['subcate'] == 910) {
            // upgrade agent
            $from = $product['province'] % 10;
            $to = int($product['province'] / 10);
            if ($user['level'] != $from) {
                return 'INVALID_CURRENT_LEVEL';
            }
            if ($user['parent'] && $user['parent'] != $ticket['agent']) {
                return 'PARENT_CONFLICTED';
            }
            $this->db->update('agent', array('level' => $to, 'parent' => $ticket['agent']), array('name' => $username));
        }
    } else {
        $this->db->insert('job', array('create_time' => time(), 'commit_time' => 0, 'ticket_number' => $ticket['number'], 'to' => $values['to'], 'area' => $values['area'], 'product_id' => $product['id'], 'locking_on' => NULL, 'retried' => 0, 'result' => 0, 'reason' => NULL));
    }
    return 'SUCCESS';
}
开发者ID:sdgdsffdsfff,项目名称:raptor,代码行数:38,代码来源:product_helper.php

示例7: get_post_by_id

function get_post_by_id($id)
{
    $mysqli = new mysqli(get_db_host(), get_db_user(), get_db_password(), get_db_database());
    $stmt = $mysqli->prepare("SELECT id, thread, reply_to, user, text, timestamp FROM post WHERE id = ? LIMIT 1");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $res = $stmt->get_result();
    if ($res->num_rows > 0) {
        $row = $res->fetch_assoc();
        $post = new Post();
        $post->set_id($row['id']);
        $post->set_thread(get_thread_by_id($row['thread']));
        if (!is_null($row['reply_to'])) {
            $post->set_reply_to(get_post_by_id($row['reply_to']));
        }
        $post->set_user(get_user_by_id($row['user']));
        $post->set_text($row['text']);
        $post->set_timestamp($row['timestamp']);
        $stmt->close();
        return $post;
    } else {
        return NULL;
    }
}
开发者ID:Cierce,项目名称:seventh-root.com,代码行数:24,代码来源:post.php

示例8: update_user

/**
 * [update_user description]
 * @param  [type] $data [description]
 * @return [type]       [description]
 */
function update_user($data)
{
    $output = false;
    $actual_data = get_user_by_id($data['id']);
    $new_data = $data;
    $full_file = get_json_content(LOCKPATH . 'users-config.json');
    $users = $full_file['users'];
    $updated_file;
    //Update Array
    foreach ($new_data as $attr => $value) {
        $actual_data[$attr] = $value;
    }
    //Attach user to file
    foreach ($users as $key => $user_data) {
        if ($user_data['id'] === $actual_data['id']) {
            $full_file['users'][$key] = $actual_data;
        }
    }
    //$updated_file = json_encode( $full_file );
    if (write_to_json(LOCKPATH . 'users-config.json', $full_file)) {
        $output = true;
    }
    return $output;
}
开发者ID:jCalderon80,项目名称:IBS-BlogSystem,代码行数:29,代码来源:iface-functions.php

示例9: include

<?php
#
# (c) C4G, Santosh Vempala, Ruban Monu and Amol Shintre
# Main page for adding new lab user account
# Called from lab_config_home.php
#

include("../users/accesslist.php");
if( !(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) 
     && !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList)) 
	 && !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) ) {
		header( 'Location: home.php' );
}

include("redirect.php");
include("includes/page_elems.php");
include("includes/script_elems.php");
LangUtil::setPageId("lab_config_home");

$script_elems = new ScriptElems();
$page_elems = new PageElems();
$reload_url = $_REQUEST['ru']."&show_u=1";
$lab_config_id = $_REQUEST['lid'];
?>
<script type="text/javascript">
function add_lab_user()
{
	var username = $('#lab_user').attr('value');
	var pwd = $('#pwd').attr('value');
	var email = $('#email').attr('value');
	var phone = $('#phone').attr('value');
开发者ID:jfurlong,项目名称:BLIS,代码行数:31,代码来源:lab_user_new.php

示例10: in_array

# Main file for updating to new version
# Calls ajax/update.php which actually performs the update operations

/*include("../users/accesslist.php");
if( !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList)) 
	&& !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) &&
	!(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) )
	header( 'Location: home.php' );
*/
include("redirect.php");
include("../includes/db_lib.php");
include("../includes/user_lib.php");

LangUtil::setPageId("update");

$user = get_user_by_id($_SESSION['user_id']);

$def = '';

if ( is_super_admin($user) || is_country_dir($user) ) {
	//$labConfigList = get_lab_configs($user->userId);
	//foreach($labConfigList as $labConfig) {
		//$labConfigId = $labConfig->id;
		//runUpdate($labConfigId);
//          }
	//runGlobalUpdate();
    $db_name = "blis_revamp";
        $ufile = "db_update_revamp";
        blis_db_update($lab_config_id, $db_name, $ufile);
        update_language_files();
        insertVersionDataEntry();
开发者ID:jfurlong,项目名称:BLIS,代码行数:31,代码来源:blis_update.php

示例11: change_password

 public function change_password()
 {
     if ($this->input->post('update')) {
         $majorsalt = '';
         $newpassword = $this->input->post('new_password');
         $password = $this->input->post('old_password');
         $user_id = $this->dx_auth->get_user_id();
         $stored_hash = get_user_by_id($user_id)->password;
         $password = $this->dx_auth->_encode($password);
         if (crypt($password, $stored_hash) === $stored_hash) {
             // if PHP5
             if (function_exists('str_split')) {
                 $_pass = str_split($newpassword);
             } else {
                 $_pass = array();
                 if (is_string($newpassword)) {
                     for ($i = 0; $i < strlen($newpassword); $i++) {
                         array_push($_pass, $newpassword[$i]);
                     }
                 }
             }
             foreach ($_pass as $_hashpass) {
                 $majorsalt .= md5($_hashpass);
             }
             $final_pass = crypt(md5($majorsalt));
             $data['password'] = $final_pass;
             $this->db->where('id', 1);
             $this->db->update('users', $data);
             echo '<p>' . translate_admin('Settings updated successfully') . '</p>';
         } else {
             echo '<span style="color:red;">' . translate_admin('Your Old Password is wrong') . '</span>';
         }
     } else {
         $data['message_element'] = "administrator/settings/change_password";
         $this->load->view('administrator/admin_template', $data);
     }
 }
开发者ID:BersnardC,项目名称:DROPINN,代码行数:37,代码来源:settings.php

示例12: site_url

                                                </div>
            <?php 
        }
        ?>

                                        </div>
                                        <div class="clsConSamll_Pro_Img clsFloatLeft">
                                            <p><a href="<?php 
        echo site_url('users/profile') . '/' . $message->userby;
        ?>
"><img height="50" width="50" alt="" src="<?php 
        echo $this->Gallery->profilepic($message->userby, 2);
        ?>
" /></a></p>
                                            <p><?php 
        echo ucfirst(get_user_by_id($message->userby)->username);
        ?>
</p>
                                        </div>
                                    </li>

        <?php 
    }
}
?>
                    </ul>
                    <div style="clear:both"></div>
                </div>

            </div>
开发者ID:empotix,项目名称:travelo,代码行数:30,代码来源:view_conversation.php

示例13: process_login

function process_login($method_name, $params, $userID)
{
    $config =& get_config();
    $userService = $config['user_service'];
    log_message('debug', "Processing new login request");
    $req = $params[0];
    $fullname = $req["first"] . ' ' . $req["last"];
    // Sanity check the request, make sure it's somewhat valid
    if (empty($userID)) {
        if (!isset($req["first"], $req["last"], $req["passwd"]) || empty($req["first"]) || empty($req["last"]) || empty($req["passwd"])) {
            return array('reason' => 'key', 'login' => 'false', 'message' => "Login request must contain a first name, last name, and password and they cannot be blank");
        }
        // Authorize the first/last/password and resolve it to a user account UUID
        log_message('debug', "Doing password-based authorization for user {$fullname}");
        $userID = authorize_identity($fullname, $req['passwd']);
        if (empty($userID)) {
            return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry! We couldn't log you in.\nPlease check to make sure you entered the right\n    * Account name\n    * Password\nAlso, please make sure your Caps Lock key is off.");
        }
        log_message('debug', sprintf("Authorization success for %s", $userID));
    } else {
        log_message('debug', sprintf("Using pre-authenticated capability for %s", $userID));
    }
    // Get information about the user account
    $user = get_user_by_id($userID);
    if (empty($user)) {
        return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry! We couldn't log you in. User account information could not be retrieved. If this problem persists, please contact the grid operator.");
    }
    $login_success = true;
    //ensure username has the same case as in the database
    $fullname = $user['Name'];
    if (!empty($user['UserFlags'])) {
        // get_user_by_id() fully decodes the structure, this is not needed
        //$userflags = json_decode($user['UserFlags'], TRUE);
        $userflags = $user['UserFlags'];
        if (!empty($userflags['Suspended']) && (bool) $userflags['Suspended'] === true) {
            $login_success = false;
            log_message('debug', "User " . $user['Name'] . " is banned.");
        } else {
            if ($user['AccessLevel'] < $config['access_level_minimum']) {
                if ($config['validation_required']) {
                    if (!empty($userflags['Validated'])) {
                        $login_success = $userflags['Validated'];
                    } else {
                        $login_success = false;
                    }
                    if (!$login_success) {
                        log_message('debug', "User " . $user['Name'] . " has not validated their email.");
                    }
                }
            }
        }
    } else {
        if ($user['AccessLevel'] < $config['access_level_minimum'] && $config['validation_required']) {
            $login_success = false;
            log_message('debug', "User " . $user['Name'] . " has not validated their email.");
        }
    }
    if (!$login_success) {
        return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry!  We couldn't log you in.  User account has been suspended or is not yet activated.  If this problem persists, please contact the grid operator.");
    }
    $lastLocation = null;
    if (isset($user['LastLocation'])) {
        $lastLocation = SceneLocation::fromOSD($user['LastLocation']);
    }
    $homeLocation = null;
    if (isset($user['HomeLocation'])) {
        $homeLocation = SceneLocation::fromOSD($user['HomeLocation']);
    }
    log_message('debug', sprintf("User retrieval success for %s", $fullname));
    // Check for an existing session
    $existingSession = get_session($userID);
    if (!empty($existingSession)) {
        log_message('debug', sprintf("Existing session %s found for %s in scene %s", $existingSession["SessionID"], $fullname, $existingSession["SceneID"]));
        $sceneID = null;
        if (UUID::TryParse($existingSession["SceneID"], $sceneID)) {
            inform_scene_of_logout($sceneID, $userID);
        }
        if (remove_session($userID)) {
            log_message('debug', "Removed existing session for {$fullname} ({$userID})");
        } else {
            log_message('warn', "Failed to remove session for {$fullname} ({$userID})");
            return array('reason' => 'presence', 'login' => 'false', 'message' => "You are already logged in from another location. Please try again later.");
        }
    } else {
        log_message('debug', "No existing session found for {$fullname} ({$userID})");
    }
    // Create a login session
    $sessionID = null;
    $secureSessionID = null;
    $extradata = array('ClientIP' => $_SERVER['REMOTE_ADDR']);
    if (!add_session($userID, $sessionID, $secureSessionID, $extradata)) {
        return array('reason' => 'presence', 'login' => 'false', 'message' => "Failed to create a login session. Please try again later.");
    }
    log_message('debug', sprintf("Session creation success for %s (%s)", $fullname, $userID));
    // Find the starting scene for this user
    $scene = null;
    $startPosition = null;
    $startLookAt = null;
    if (!find_start_location($req['start'], $lastLocation, $homeLocation, $scene, $startPosition, $startLookAt) || !isset($scene->ExtraData['ExternalAddress'], $scene->ExtraData['ExternalPort'])) {
        return array('reason' => 'presence', 'login' => 'false', 'message' => "Error connecting to the grid. No suitable region to connect to.");
//.........这里部分代码省略.........
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:101,代码来源:index.php

示例14: switch

/**
 * If the form was submited with errors, show them here.
 */
$valid_me->list_errors();
?>
		
		<?php 
if (isset($edit_response)) {
    /**
     * Get the process state and show the corresponding ok or error message.
     */
    switch ($edit_response['query']) {
        case 1:
            $msg = __('User edited correctly.', 'cftp_admin');
            echo system_message('ok', $msg);
            $saved_user = get_user_by_id($user_id);
            /** Record the action log */
            $new_log_action = new LogActions();
            $log_action_args = array('action' => 13, 'owner_id' => $global_id, 'affected_account' => $user_id, 'affected_account_name' => $saved_user['username'], 'get_user_real_name' => true);
            $new_record_action = $new_log_action->log_action_save($log_action_args);
            break;
        case 0:
            $msg = __('There was an error. Please try again.', 'cftp_admin');
            echo system_message('error', $msg);
            break;
    }
} else {
    /**
     * If not $edit_response is set, it means we are just entering for the first time.
     */
    $direct_access_error = __('This page is not intended to be accessed directly.', 'cftp_admin');
开发者ID:google-code-backups,项目名称:clients-oriented-ftp,代码行数:31,代码来源:users-edit.php

示例15: get_list_by_id

                                    <p> <?php 
        echo get_list_by_id($row->list_id)->address;
        ?>
 </p> 
                                </td>
                                <td width="25%">
                                    <p> <img height="50" width="50" alt="image" style="float:left; margin:0 10px 10px 0;" src="<?php 
        echo $this->Gallery->profilepic($row->userby, 2);
        ?>
" />
                                        <span class="clsBold">
                                            <a href="<?php 
        echo site_url('users/profile') . '/' . $row->userby;
        ?>
"><?php 
        echo ucfirst(get_user_by_id($row->userby)->username);
        ?>
</a>
                                        </span></p>
                                    <p style="margin:5px 0 0 0;"><a class="clsLink2_Bg" href="<?php 
        echo site_url('trips/send_message/' . $row->userby);
        ?>
"><?php 
        echo translate("View") . ' / ' . translate("Send") . ' ' . translate("Message");
        ?>
</a></p>
                                </td>
                                <td width="15%">
                                    <p><?php 
        echo get_currency_symbol($row->list_id) . get_currency_value1($row->list_id, $row->price);
        ?>
开发者ID:empotix,项目名称:travelo,代码行数:31,代码来源:view_myreservation.php


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