• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_session函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: update

 public function update($id, array $data, $log = true)
 {
     $data['updated_at'] = get_time();
     if (is_session('user_id')) {
         $data['updated_by'] = get_session('user_id');
     }
     $where = $this->getAdapter()->quoteInto('id = ?', $id);
     parent::update($data, $where);
     if ($log) {
         log_sql($this->_name, $id, 'updated', $data);
         set_session('notice', 'current record saved');
     }
 }
开发者ID:shadobladez,项目名称:erp2,代码行数:13,代码来源:Application.php


示例17: is_admin

function is_admin()
{
    if (session_is_live()) {
        $session = get_session();
        if ($session['login'] == $GLOBALS['admin_username']) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:wedesign-pf,项目名称:Tit,代码行数:13,代码来源:session_functions.php


示例18: antiRePost

function antiRePost($sendStr)
{
    global $RefreshType;
    global $anit_refresh;
    if ($sendStr == get_session('PostSendStr')) {
        if (isset($RefreshType) == 'ajax') {
            action_return(2, 'error:' . $anit_refresh, "-1");
        } else {
            action_return(1, $anit_refresh, "-1");
        }
    }
    set_session('PostSendStr', $sendStr);
}
开发者ID:omusico,项目名称:Social,代码行数:13,代码来源:aanti_refresh.php


示例19: get_user

 function get_user()
 {
     $cookie_user = ci_get_cookie('user');
     if ($cookie_user) {
         $this->user = json_decode($cookie_user, true);
         set_session('user', $this->user);
     } else {
         $this->user = get_session('user');
     }
     if ($this->user) {
         $this->uid = $this->user['uid'];
         $this->load->vars('user', $this->user);
     }
 }
开发者ID:chentaoz,项目名称:TourismWeb,代码行数:14,代码来源:MY_Controller.php


示例20: JKY_generate_checkout

/**
 *	generate CheckOut from Planning Orders
 *
 * @param	int		order_id
 * @return	int		count of CheckOuts generated
 */
function JKY_generate_checkout($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM Orders' . ' WHERE id = ' . $the_id;
    $my_order = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM OrdThreads' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    /*
    	$my_needed_at = $my_order['needed_at'];
    	if ($my_needed_at == null) {
    		$my_needed_at = get_time();
    	}
    */
    $my_checkout_id = get_next_id('CheckOuts');
    $sql = 'INSERT CheckOuts' . '   SET          id =' . $my_checkout_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',           number =' . $my_checkout_id . ',     requested_at ="' . get_time() . '"' . ', requested_weight =' . $my_order['ordered_weight'];
    if ($my_order['machine_id']) {
        $sql .= ', machine_id=' . $my_order['machine_id'];
    }
    if ($my_order['partner_id']) {
        $sql .= ', partner_id=' . $my_order['partner_id'];
    }
    log_sql('CheckOuts', 'INSERT', $sql);
    $db->query($sql);
    insert_changes($db, 'CheckOuts', $my_checkout_id);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_ord_thread_id = $my_row['id'];
        $my_batch = db_get_row('Batches', 'id=' . $my_row['batchin_id']);
        $my_ordered_weight = $my_row['ordered_weight'];
        $my_ordered_boxes = ceil((double) $my_ordered_weight / (double) $my_batch['average_weight']);
        $my_batchout_id = get_next_id('BatchOuts');
        $sql = 'INSERT BatchOuts' . '   SET          id =' . $my_batchout_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',      checkout_id =' . $my_checkout_id . ',        thread_id =' . $my_row['thread_id'] . ',       batchin_id =' . $my_row['batchin_id'] . ',  order_thread_id =' . $my_ord_thread_id . ',            batch ="' . $my_batch['batch'] . '"' . ',       unit_price =' . $my_batch['unit_price'] . ',   average_weight =' . $my_batch['average_weight'] . ', requested_weight =' . $my_ordered_weight . ',  requested_boxes =' . $my_ordered_boxes;
        log_sql('BatchOuts', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'BatchOuts', $my_batchout_id);
        $sql = 'UPDATE OrdThreads' . '   SET batchout_id = ' . $my_batchout_id . ' WHERE id = ' . $my_ord_thread_id;
        log_sql('OrdThreads', 'UPDATE', $sql);
        $db->query($sql);
        insert_changes($db, 'OrdThreads', $my_ord_thread_id);
        $my_count++;
    }
    $sql = 'UPDATE Orders' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('Orders', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'Orders', $the_id);
    return $my_count;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:53,代码来源:Generate_CheckOut.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_set_focus_js函数代码示例发布时间:2022-05-15
下一篇:
PHP get_sess_username函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap