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

PHP setSessionVar函数代码示例

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

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



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

示例1: logUserOut

function logUserOut()
{
    setSessionVar('login', false);
    setCookie('keep_log', '0', time() - 3600, '/', $_SERVER['HTTP_HOST'], false, true);
    unset($_COOKIE['keep_log']);
    quitSession();
}
开发者ID:extendgears,项目名称:php-components,代码行数:7,代码来源:log.php


示例2: database

require_once $CONFIG['dir']->includes . '/database.php';
$database = new database($CONFIG['db']->host, $CONFIG['db']->user, $CONFIG['db']->pass, $CONFIG['db']->name, null);
//$database->debug( $CONFIG['site']->debug );
// check if user is logging in
if ($_REQUEST['login']) {
    // check username and password
    $user = new stdClass();
    $sql = "SELECT *\n\t\t\tFROM Users\n\t\t\tWHERE username='" . $_REQUEST['username'] . "'\n\t\t\t\tAND password='" . $_REQUEST['password'] . "'";
    $database->setQuery($sql);
    if ($database->loadObject($user)) {
        // successful login
        $GLOBALS['user'] = $user;
        // get preferences
        $GLOBALS['preferences']->regions = textarea_to_array($user->regions);
        $GLOBALS['preferences']->sites = textarea_to_array($user->sites);
        setSessionVar('uname', $user->username);
    } else {
        $err = 'Login failed. Please try again.';
    }
} else {
    if (isset($_REQUEST['logout'])) {
        // logout user
        unset($GLOBALS['user']);
        unset($GLOBALS['preferences']);
        delSessionVar('uname');
        // redirect to clear the logout in QUERY STRING
        header('Location:' . $_SERVER['PHP_SELF']);
        exit;
    } else {
        if (getSessionVar('uname')) {
            // check username and password
开发者ID:grantconk,项目名称:CLTools,代码行数:31,代码来源:CLTools.php


示例3: getPriceBookRelatedServices

 /**	Function to display the Services which are related to the PriceBook
  *	@param string $query - query to get the list of products which are related to the current PriceBook
  *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
  *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
  *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Service entries
  */
 function getPriceBookRelatedServices($query, $focus, $returnset = '')
 {
     global $log;
     $log->debug("Entering getPriceBookRelatedServices(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
     global $adb;
     global $app_strings;
     global $current_language, $current_user;
     $current_module_strings = return_module_language($current_language, 'Services');
     global $list_max_entries_per_page;
     global $urlPrefix;
     global $theme;
     $pricebook_id = $_REQUEST['record'];
     $theme_path = "themes/" . $theme . "/";
     $image_path = $theme_path . "images/";
     $computeCount = $_REQUEST['withCount'];
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
         $noofrows = $adb->query_result($adb->query(mkCountQuery($query)), 0, 'count');
     } else {
         $noofrows = null;
     }
     $module = 'PriceBooks';
     $relatedmodule = 'Services';
     if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
         $modObj = new ListViewSession();
         $modObj->sortby = $focus->default_order_by;
         $modObj->sorder = $focus->default_sort_order;
         $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
     }
     if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
         $relmodule = vtlib_purify($_REQUEST['relmodule']);
         if ($_SESSION['rlvs'][$module][$relmodule]) {
             setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
         }
     }
     global $relationId;
     $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
     $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
     $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
     if ($adb->dbType == "pgsql") {
         $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
     } else {
         $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
     }
     $header = array();
     $header[] = $current_module_strings['LBL_LIST_SERVICE_NAME'];
     if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
         $header[] = $current_module_strings['LBL_SERVICE_UNIT_PRICE'];
     }
     $header[] = $current_module_strings['LBL_PB_LIST_PRICE'];
     if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
         $header[] = $app_strings['LBL_ACTION'];
     }
     $currency_id = $focus->column_fields['currency_id'];
     $numRows = $adb->num_rows($list_result);
     for ($i = 0; $i < $numRows; $i++) {
         $entity_id = $adb->query_result($list_result, $i, "crmid");
         $unit_price = $adb->query_result($list_result, $i, "unit_price");
         if ($currency_id != null) {
             $prod_prices = getPricesForProducts($currency_id, array($entity_id), 'Services');
             $unit_price = $prod_prices[$entity_id];
         }
         $listprice = $adb->query_result($list_result, $i, "listprice");
         $field_name = $entity_id . "_listprice";
         $entries = array();
         $entries[] = textlength_check($adb->query_result($list_result, $i, "servicename"));
         if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
             $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
         }
         $entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
         $action = "";
         if (isPermitted("PriceBooks", "EditView", "") == 'yes' && isPermitted('Services', 'EditView', $entity_id) == 'yes') {
             $action .= '<img style="cursor:pointer;" src="themes/images/editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . $listprice . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
         } else {
             $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
         }
         if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Services', 'Delete', $entity_id) == 'yes') {
             if ($action != "") {
                 $action .= '&nbsp;|&nbsp;';
             }
             $action .= '<img src="themes/images/delete.gif" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
         }
         if ($action != "") {
             $entries[] = $action;
         }
         $entries_list[] = $entries;
     }
     $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
     $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, '', $module, $relatedmodule, $focus->id);
     $return_data = array('header' => $header, 'entries' => $entries_list, 'navigation' => $navigationOutput);
     $log->debug("Exiting getPriceBookRelatedServices method ...");
     return $return_data;
 }
开发者ID:mslokhat,项目名称:corebos,代码行数:98,代码来源:Services.php


示例4: getListQuery

}
if ($viewid != "0") {
    //change by xiaoyang on 2012-09-14
    //$listquery = $focus->getListQuery($where);
    $listquery = getListQuery("Memdays");
    $query = $oCustomView->getModifiedCvListQuery($viewid, $listquery, "Memdays");
} else {
    $query = $focus->getListQuery($where);
}
//<<<<<<<<customview>>>>>>>>>
//Retreiving the no of rows
$count_result = $adb->query(mkCountQuery($query));
$noofrows = $adb->query_result($count_result, 0, "count");
//Storing Listview session object
if ($_SESSION['lvs'][$currentModule]) {
    setSessionVar($_SESSION['lvs'][$currentModule], $noofrows, $list_max_entries_per_page);
}
$start = $_SESSION['lvs'][$currentModule]['start'];
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
// Setting the record count string
//modified by rdhital
$start_rec = $navigation_array['start'];
$end_rec = $navigation_array['end_val'];
//By raju Ends
$_SESSION['nav_start'] = $start_rec;
$_SESSION['nav_end'] = $end_rec;
//limiting the query
if (isset($order_by) && $order_by != '') {
    if ($order_by == 'smownerid') {
        $query_order_by = 'user_name';
开发者ID:Pengzw,项目名称:c3crm,代码行数:31,代码来源:ListView.php


示例5: Image

	
	$tmpl->hex = Color::RGBToHex(60, 120, 60);
	$tmpl->alpha = Color::HexToRGBA($tmpl->hex, .5);
	$tmpl->rgb = Color::HexToRGB($tmpl->hex);
	
	$img = new Image();
	$img->source = 'portrait.png';
	$img->Write->Normal(20, 20, "A Self Portrait of Me", 5, "#000000", 1);
	$img->destination = 'portrait2.png';
	$img->output();
	$img->clean();
	unset($img);
	
	//start a session and store a variable;
	setSession(0,'/'); // expires with browser session, the root is '/'
	setSessionVar('foo', 'bar'); //there's no retrieval function, so this is kind of stupid
	if( !isset($_SESSION['foo']) ){
		throw new RedirectBrowserException("example.php");
	}
	
	//Database calls
	/*
	$db = new Database("username", "password", "database name", "location of database", "type of database"); // currently only supports "mysql"
	$sql = "SELECT * FROM mytable WHERE myid=?";
	$values = array(4); // myid
	
	$result = $db->qwv($sql, $values); // query with values, returns array of rows (can be empty)
	
	if( $db->stat() ) // <-- the boolean representing whether the last query was successful{
		foreach( $result as $row ){
			print $row['myid'] . "<br />";
开发者ID:rockerest,项目名称:vertebrox,代码行数:30,代码来源:example.php


示例6: isset

	$role = isset($_POST['register_role']) ? $_POST['register_role'] : 3;
	
	if( $action == 'login' )
	{
		if( $password != null && $identity != null )
		{
			$tmp = Authentication::validate($identity, $password);
			
			if( $tmp )
			{
				setSessionVar('active', true);
				setSessionVar('fname', $tmp->fname);
				setSessionVar('lname', $tmp->lname);
				setSessionVar('roleid', $tmp->authentication->role->roleid);
				setSessionVar('userid', $tmp->userid);
				setSessionVar('isAnon', false);
				
				kick(2, null, 0 );
			}
			else
			{
				kick(0, array('identity' => $identity), 1);
			}
		}
		else
		{
			kick(0, array('identity' => $identity), 2);
		}
	}
	elseif( $action == 'register' )
	{
开发者ID:rockerest,项目名称:capstone,代码行数:31,代码来源:Login.php


示例7: foreach

    $_SESSION = $parsed;
    $_SESSION['prototype'] = $csd;
}
// Handle datachanges
$sessiondata = "";
if (!empty($_POST['session'])) {
    foreach ($_POST['session'] as $key => $postSession) {
        setSessionVar($key, $postSession);
        $sessiondata .= print_r($postSession, true);
    }
    $parsed = $_SESSION;
}
if (!empty($_GET)) {
    foreach ($_GET as $key => $value) {
        if (!empty($_SESSION[$key])) {
            setSessionVar($key, $value);
        }
    }
    $parsed = $_SESSION;
}
// Expose each session key as variable and handle livesearch entry
$mykeys = array();
foreach ($parsed as $key => $item) {
    ${$key} = $item;
    if (is_array(${$key})) {
        $url = "";
        if (!empty(${$key}[0]) && ${$key}[0] == 'parse') {
            if (!empty(${$key}[2])) {
                $tempvar = ${$key}[1](${$key}[2]);
            } else {
                $tempvar = ${$key}[1]();
开发者ID:privamail,项目名称:Protostrap,代码行数:31,代码来源:dataParse.php


示例8: isset

	require_once('Session.php');
	require_once('Quick_Login.php');
	setSession(0, '/');

	$code = isset($_GET['code']) ? $_GET['code'] : null;

	if( $code ){
		$ql = Quick_Login::getByHash($code);
		if( $ql ){
			$user = User::getByID($ql->userid);
			$user->disabled = 0;
			$user->save();

			setSessionVar('active', true);
			setSessionVar('roleid', $user->authentication->role->roleid);
			setSessionVar('userid', $user->userid);

			$ql->used = 1;
			$ql->save();

			throw new RedirectBrowserException("/home.php?code=0");
		}
		else{
			throw new RedirectBrowserException('/index.php?code=9');
		}
	}
	else{
		throw new RedirectBrowserException('/index.php?code=9');
	}
?>
开发者ID:rockerest,项目名称:Afterthought,代码行数:30,代码来源:verify.php


示例9: getPriceBookRelatedProducts

/**	Function to display the Products which are related to the PriceBook
 *	@param string $query - query to get the list of products which are related to the current PriceBook
 *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
 *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
 *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
 */
function getPriceBookRelatedProducts($query, $focus, $returnset = '')
{
    global $log;
    $log->debug("Entering getPriceBookRelatedProducts(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
    global $adb;
    global $app_strings;
    global $mod_strings;
    global $current_language, $current_user;
    $current_module_strings = return_module_language($current_language, 'PriceBook');
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $theme;
    $pricebook_id = vtlib_purify($_REQUEST['record']);
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $noofrows = $adb->query_result($adb->query(mkCountQuery($query)), 0, 'count');
    $module = 'PriceBooks';
    $relatedmodule = 'Products';
    if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
        $modObj = new ListViewSession();
        $modObj->sortby = $focus->default_order_by;
        $modObj->sorder = $focus->default_sort_order;
        $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    $start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    //limiting the query
    if ($start_rec == 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    if ($adb->dbType == "pgsql") {
        $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
    } else {
        $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    }
    $header = array();
    $header[] = $mod_strings['LBL_LIST_PRODUCT_NAME'];
    if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_CODE'];
    }
    if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE'];
    }
    $header[] = $mod_strings['LBL_PB_LIST_PRICE'];
    if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
        $header[] = $mod_strings['LBL_ACTION'];
    }
    $currency_id = $focus->column_fields['currency_id'];
    $numRows = $adb->num_rows($list_result);
    for ($i = 0; $i < $numRows; $i++) {
        $entity_id = $adb->query_result($list_result, $i, "crmid");
        $unit_price = $adb->query_result($list_result, $i, "unit_price");
        if ($currency_id != null) {
            $prod_prices = getPricesForProducts($currency_id, array($entity_id));
            $unit_price = $prod_prices[$entity_id];
        }
        $listprice = $adb->query_result($list_result, $i, "listprice");
        $field_name = $entity_id . "_listprice";
        $entries = array();
        $entries[] = textlength_check($adb->query_result($list_result, $i, "productname"));
        if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
            $entries[] = $adb->query_result($list_result, $i, "productcode");
        }
        if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
            $entries[] = $unit_price;
        }
        $entries[] = $listprice;
        $action = "";
        if (isPermitted("PriceBooks", "EditView", "") == 'yes') {
            $action .= '<img style="cursor:pointer;" src="' . vtiger_imageurl('editfield.gif', $theme) . '" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . $listprice . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
        }
        if (isPermitted("PriceBooks", "Delete", "") == 'yes') {
            if ($action != "") {
                $action .= '&nbsp;|&nbsp;';
            }
            $action .= '<img src="' . vtiger_imageurl('delete.gif', $theme) . '" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
        }
        if ($action != "") {
            $entries[] = $action;
        }
        $entries_list[] = $entries;
    }
    if ($numRows > 0) {
        $module_rel = "{$module}&relmodule={$relatedmodule}&record=" . $focus->id;
//.........这里部分代码省略.........
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:101,代码来源:RelatedListView.php


示例10: implode

	$includePath = implode( PATH_SEPARATOR . $home, $paths );
	set_include_path( get_include_path() . PATH_SEPARATOR . $includePath );

	require_once('RedirectBrowserException.php');
	require_once('Authentication.php');
	require_once('User.php');
	require_once('Session.php');
	setSession(0, '/');

	$password = isset($_POST['password']) ? $_POST['password'] : null;
	$identity = isset($_POST['email']) ? $_POST['email'] : null;

	if( $password != null && $identity != null ){
		$tmp = Authentication::validate($identity, $password);

		if( $tmp ){
			setSessionVar('active', true);
			setSessionVar('roleid', $tmp->authentication->role->roleid);
			setSessionVar('userid', $tmp->userid);

			throw new RedirectBrowserException("/home.php?code=0");
		}
		else{
			throw new RedirectBrowserException("/index.php?code=1&email=" . $identity);
		}
	}
	else{
		throw new RedirectBrowserException("/index.php?code=0&email=" . $identity);
	}
?>
开发者ID:rockerest,项目名称:Afterthought,代码行数:30,代码来源:Login.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP setSqlCacheData函数代码示例发布时间:2022-05-15
下一篇:
PHP setSession函数代码示例发布时间: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