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


PHP get_session函数代码示例

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


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

示例1: change_password

function change_password($newPassword)
{
    global $root;
    $sessionID = get_session();
    //echo "SESSION ID IS: " . htmlspecialchars($sessionID) . "\n";
    if (!isset($sessionID)) {
        echo "sessionID is not set?";
        //echo htmlspecialchars($sessionID);
        die;
    } else {
        //$sessionID = $session->SessionID;
        // required parameters for /changePassword
        $args = array('accountNum' => API_ACCOUNT_NUM, 'session' => $sessionID, 'newPassword' => $newPassword, 'password' => $_POST['current_password']);
        $result = build_api_request('/changePassword', $args);
        // error handling for changing the password
        $json_result = json_decode($result);
        //echo "json_result-Status = " . $json_result->Status;
        if (!isset($json_result->Status)) {
            echo '<div id="bigContent">';
            echo "Invalid request.";
            echo '</div>';
            include "{$root}/footer.php";
            die;
        } else {
            echo '<div id="bigContent">';
            echo $json_result->Status . '<br />';
            echo "Please update your config.inc.php file to reflect your changed password in order to prevent errors when accessing the fed API.";
            echo '</div>';
            include "{$root}/footer.php";
            die;
        }
    }
}
开发者ID:bjh7242,项目名称:ISTS14-Stuff,代码行数:33,代码来源:change_fed_password.php

示例2: JKY_combine_batchouts

/**
 *	combine BatchOuts from Threads
 *
 * @param	int		order_id
 * @return	int		count of CheckOuts combined
 */
function JKY_combine_batchouts($the_ids)
{
    $db = Zend_Registry::get('db');
    $my_id = get_next_id('BatchOuts');
    $sql = 'INSERT INTO BatchOuts ' . 'SELECT ' . $my_id . '    	, ' . get_session('user_id') . '     , NOW()' . '     , status' . '     , MIN(checkout_id)' . '     , thread_id' . '     , batchin_id' . '     , req_line_id' . '     , tdyer_thread_id' . '     , order_thread_id' . '     , code' . '     , batch' . '     , AVG(unit_price)' . '     , SUM(requested_weight)' . '     , AVG(average_weight)' . '     , SUM(requested_boxes)' . '     , SUM(reserved_boxes)' . '     , SUM(checkout_boxes)' . '     , SUM(checkout_weight)' . '  FROM BatchOuts' . ' WHERE id IN (' . $the_ids . ')';
    log_sql('BatchOuts', $my_id, $sql);
    $db->query($sql);
    insert_changes($db, 'BatchOuts', $my_id);
    $sql = 'SELECT *' . '  FROM BatchOuts' . ' WHERE id IN (' . $the_ids . ')';
    log_sql('BatchOuts', $my_id, $sql);
    /*
    	$sql= 'UPDATE BatchOuts '
    	    . '   SET status = "History"'
    		. '  FROM BatchOuts'
    		. ' WHERE id IN (' . $the_ids . ')'
    		;
    */
    $my_rows = $db->fetchAll($sql);
    foreach ($my_rows as $my_row) {
        $sql = 'UPDATE BatchOuts' . '   SET status = "History"' . ' WHERE id = ' . $my_row['id'];
        log_sql('BatchOuts', $my_row['id'], $sql);
        $db->query($sql);
        insert_changes($db, 'BatchOuts', $my_row['id']);
    }
    return $my_id;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:32,代码来源:Combine_BatchOuts.php

示例3: auth_error

function auth_error($exception = null)
{
    global $connection, $adminer, $token;
    $session_name = session_name();
    $error = "";
    if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
        $error = lang('Session support must be enabled.');
    } elseif (isset($_GET["username"])) {
        if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) {
            $error = lang('Session expired, please login again.');
        } else {
            $password =& get_session("pwds");
            if (isset($password)) {
                $error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
                $password = null;
            }
        }
    }
    page_header(lang('Login'), $error, null);
    echo "<form action='' method='post' onclick='eventStop(event);'>\n";
    $adminer->loginForm();
    echo "<div>";
    hidden_fields($_POST, array("driver", "server", "username", "password", "permanent"));
    // expired session
    echo "</div>\n";
    echo "</form>\n";
    page_footer("auth");
}
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:28,代码来源:auth.inc.php

示例4: make_mp3

function make_mp3()
{
    global $config;
    $number = get_session("ss_captcha_key");
    if ($number == "") {
        return;
    }
    if ($number == get_session("ss_captcha_save")) {
        return;
    }
    $mp3s = array();
    for ($i = 0; $i < strlen($number); $i++) {
        $file = G5_CAPTCHA_PATH . '/mp3/' . $config['cf_captcha_mp3'] . '/' . $number[$i] . '.mp3';
        $mp3s[] = $file;
    }
    $ip = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR']));
    $mp3_file = 'data/cache/kcaptcha-' . $ip . '_' . G5_SERVER_TIME . '.mp3';
    $contents = '';
    foreach ($mp3s as $mp3) {
        $contents .= file_get_contents($mp3);
    }
    file_put_contents(G5_PATH . '/' . $mp3_file, $contents);
    // 지난 캡챠 파일 삭제
    if (rand(0, 99) == 0) {
        foreach (glob(G5_PATH . '/data/cache/kcaptcha-*.mp3') as $file) {
            if (filemtime($file) + 86400 < G5_SERVER_TIME) {
                @unlink($file);
            }
        }
    }
    set_session("ss_captcha_save", $number);
    return G5_URL . '/' . $mp3_file;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:33,代码来源:kcaptcha_mp3.php

示例5: JKY_generate_purchase

/**
 *	generate Purchase
 *
 * @param	int		purchase_id
 * @return	int		count of Incomings generated
 */
function JKY_generate_purchase($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM Purchases' . ' WHERE id = ' . $the_id;
    $my_purchase = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM PurchaseLines' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_incoming_id = get_next_id('Incomings');
        $sql = 'INSERT Incomings' . '   SET         id = ' . $my_incoming_id . ',      updated_by = ' . get_session('user_id') . ',      updated_at ="' . get_time() . '"' . ', incoming_number = ' . $my_incoming_id . ',     supplier_id = ' . $my_purchase['supplier_id'] . ',    invoice_date ="' . $my_row['expected_date'] . '"' . ',  invoice_weight = ' . $my_row['expected_weight'];
        log_sql('Incomings', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'Incomings', $my_incoming_id);
        $my_batchin_id = get_next_id('Batches');
        $sql = 'INSERT Batches' . '   SET          id = ' . $my_batchin_id . ',       updated_by = ' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',      incoming_id = ' . $my_incoming_id . ',        thread_id = ' . $my_row['thread_id'] . ', purchase_line_id = ' . $my_row['id'];
        log_sql('Batches', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'Batches', $my_batchin_id);
        $sql = 'UPDATE PurchaseLines' . '   SET batch_id =  ' . $my_batchin_id . ' WHERE id = ' . $my_row['id'];
        log_sql('PurchaseLines', 'UPDATE', $sql);
        $db->query($sql);
        insert_changes($db, 'PurchaseLines', $my_row['id']);
        $my_count++;
    }
    $sql = 'UPDATE Purchases' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('Purchases', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'Purchases', $the_id);
    return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:37,代码来源:Generate_Purchase.php

示例6: i_am_logged

/**
 * i_am_logged 
 * 
 * @access public
 * @return boolean
 */
function i_am_logged()
{
    $session = get_session();
    if (!$session->islogged()) {
        throw new LoginRequiredException();
    }
    return true;
}
开发者ID:jouvent,项目名称:Genitura,代码行数:14,代码来源:security.php

示例7: get_user_session

/**
 * fungsi khusus untuk mendapatkan session user
 */
function get_user_session($key, $default = '')
{
    if (has_session('user')) {
        $user = get_session('user');
        return isset($user[$key]) ? $user[$key] : $default;
    }
    return $default;
}
开发者ID:londomloto,项目名称:immortal,代码行数:11,代码来源:session.php

示例8: my_page

/**
 * my_page 
 * 
 * @access public
 * @return string
 */
function my_page()
{
    $session = get_session();
    if (!$session->logged) {
        return redirect('/');
    }
    $me = $session->whoAMI();
    return view_user($me[0]);
}
开发者ID:jouvent,项目名称:Genitura,代码行数:15,代码来源:controllers.php

示例9: get_logged_user

/**
 * get_logged_user 
 * 
 * @access public
 * @return User
 */
function get_logged_user()
{
    static $user;
    if (!$user) {
        $session = get_session();
        $user = $session->get_logged_user();
    }
    return $user;
}
开发者ID:jouvent,项目名称:Genitura,代码行数:15,代码来源:singletons.php

示例10: is_access

function is_access($try)
{
    $access = 0;
    $temp = get_session('user');
    $user_entry = strlen($temp) > 0 ? unserialize($temp) : null;
    if ($user_entry != null) {
        $access = $user_entry['access'];
    }
    return ($access & $try) == $try ? true : false;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:10,代码来源:user.lib.php

示例11: csrf_verify

function csrf_verify($name, $token)
{
    $hash = get_session($name);
    $valid = false;
    if ($hash === $token) {
        $valid = true;
    }
    unset_session($name);
    return $valid;
}
开发者ID:londomloto,项目名称:immortal,代码行数:10,代码来源:security.php

示例12: check_rights

function check_rights($code)
{
    $is_pass = 1;
    if (get_session('admin_group') != 'superadmin') {
        $local_rights = get_session('rights');
        if (!stripos(",,{$local_rights},", ",{$code},")) {
            $is_pass = 0;
        }
    }
    return $is_pass;
}
开发者ID:omusico,项目名称:Social,代码行数:11,代码来源:fcheck_rights.php

示例13: JKY_generate_order

/**
 *	generate Order from OSAs
 *
 * @param	int		quotation_id
 * @return	int		count of Orders generated
 */
function JKY_generate_order($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM OSAs' . ' WHERE id = ' . $the_id;
    $my_osa = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM OSA_Lines' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_osa_line_id = $my_row['id'];
        $sql = 'SELECT *' . '  FROM OSA_Colors' . ' WHERE parent_id = ' . $my_osa_line_id;
        $my_colors = $db->fetchAll($sql);
        foreach ($my_colors as $my_color) {
            $my_order_id = get_next_id('Orders');
            $sql = 'INSERT Orders' . '   SET          id =' . $my_order_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',     order_number =' . $my_order_id . ',      osa_line_id =' . $my_osa_line_id . ',       osa_number =' . $my_osa['osa_number'] . ',       ordered_at ="' . $my_osa['ordered_at'] . '"' . ',        needed_at ="' . $my_osa['needed_at'] . '"' . ',     quoted_units =' . $my_row['units'] . ',    quoted_pieces =' . $my_color['quoted_pieces'] . ',    quoted_weight =' . $my_color['quoted_weight'] . ',   ordered_pieces =' . $my_color['ordered_pieces'] . ',   ordered_weight =' . $my_color['ordered_weight'];
            if ($my_osa['customer_id']) {
                $sql .= ', customer_id=' . $my_osa['customer_id'];
            }
            if ($my_row['product_id']) {
                $sql .= ',  product_id=' . $my_row['product_id'];
            }
            if ($my_color['color_id']) {
                $sql .= ',    color_id=' . $my_color['color_id'];
            }
            if ($my_color['ftp_id']) {
                $sql .= ',      ftp_id=' . $my_color['ftp_id'];
            }
            if ($my_color['machine_id']) {
                $sql .= ',  machine_id=' . $my_color['machine_id'];
            }
            if ($my_color['partner_id']) {
                $sql .= ',  partner_id=' . $my_color['partner_id'];
            }
            log_sql('Orders', 'INSERT', $sql);
            $db->query($sql);
            insert_changes($db, 'Orders', $my_order_id);
            /*
            			$sql= 'UPDATE OSA_lines'
            				. '   SET status = "Active"'
            				. ' WHERE id = ' . $my_row['id']
            				;
            	log_sql('OSA_Lines', 'UPDATE', $sql);
            			$db->query($sql);
            			insert_changes($db, 'OSA_Lines', $my_row['id']);
            */
            $my_count++;
        }
    }
    $sql = 'UPDATE OSAs' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('OSAs', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'OSAs', $the_id);
    return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:60,代码来源:Generate_Order.php

示例14: check_dup

function check_dup($uid, $cid, &$ret)
{
    $sess = get_session($uid);
    if ($sess['fv'] > 100) {
        if ($sess['_cid'] != $cid) {
            $ret['s'] = 'dup';
            return $ret;
        }
    }
    return false;
}
开发者ID:uning,项目名称:mallb,代码行数:11,代码来源:auth_tools.php

示例15: code_exists

function code_exists()
{
    $is_admin = '';
    $sendor_id = '';
    $admin_id = get_session('admin_id');
    if ($admin_id) {
        $is_admin = 1;
        $sendor_id = $admin_id;
    } else {
        $user_id = get_sess_userid();
        if (!$user_id) {
            return false;
            exit;
        }
        $is_admin = 0;
        $sendor_id = $user_id;
    }
    if ($sendor_id != '' && $is_admin !== '') {
        global $inviteCodeValue;
        global $tablePreStr;
        global $inviteCodeLength;
        $t_invite_code = $tablePreStr . "invite_code";
        $t_users = $tablePreStr . "users";
        if ($is_admin == 0) {
            $user_info = api_proxy('user_self_by_uid', 'integral', $sendor_id);
            $intg = $user_info['integral'];
            if ($inviteCodeValue > $intg) {
                return false;
            }
        }
        $dbo = new dbex();
        dbplugin('r');
        $invite_code = randkeys($inviteCodeLength);
        $sql = "select id from {$t_invite_code} where code_txt='{$invite_code}'";
        $is_exists = $dbo->getRow($sql);
        if ($is_exists['id']) {
            code_exists();
        } else {
            $time = time();
            $sql = "insert into {$t_invite_code} (sendor_id,code_txt,is_admin,add_time) values({$sendor_id},'{$invite_code}',0,{$time})";
            $success = $dbo->exeUpdate($sql);
            if ($success) {
                if ($is_admin == 0) {
                    $sql = "update {$t_users} set integral=integral-{$inviteCodeValue} where user_id={$sendor_id}";
                    $dbo->exeUpdate($sql);
                }
                return $invite_code;
            } else {
                return false;
            }
        }
    }
}
开发者ID:omusico,项目名称:Social,代码行数:53,代码来源:produce_rand.php


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