本文整理汇总了PHP中PMA_setCookie函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_setCookie函数的具体用法?PHP PMA_setCookie怎么用?PHP PMA_setCookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_setCookie函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
if ($db == $target_db && $table == $new_name) {
$message = isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames;
} else {
PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
$js_to_run = 'functions.js';
$message = isset($submit_move) ? $strMoveTableOK : $strCopyTableOK;
$message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
$reload = 1;
/* Check: Work on new table or on old table? */
if (isset($submit_move)) {
$db = $target_db;
$table = $new_name;
} else {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if (isset($switch_to_new) && $switch_to_new == 'true') {
PMA_setCookie('pma_switch_to_new', 'true');
$db = $target_db;
$table = $new_name;
} else {
PMA_removeCookie('pma_switch_to_new');
}
}
}
require_once './libs/header.inc.php';
} else {
require_once './libs/header.inc.php';
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
}
/**
* Back to the calling script
*/
示例2: parse_url
// Generate filename and mime type if needed
if ($asfile) {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
if ($export_type == 'server') {
if (isset($remember_template)) {
PMA_setCookie('pma_server_filename_template', $filename_template);
}
$filename = str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template));
} elseif ($export_type == 'database') {
if (isset($remember_template)) {
PMA_setCookie('pma_db_filename_template', $filename_template);
}
$filename = str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template)));
} else {
if (isset($remember_template)) {
PMA_setCookie('pma_table_filename_template', $filename_template);
}
$filename = str_replace('__TABLE__', $table, str_replace('__DB__', $db, str_replace('__SERVER__', $GLOBALS['cfg']['Server']['host'], strftime($filename_template))));
}
// convert filename to iso-8859-1, it is safer
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'])) {
$filename = PMA_convert_string($charset, 'iso-8859-1', $filename);
} else {
$filename = PMA_convert_string($convcharset, 'iso-8859-1', $filename);
}
// Grab basic dump extension and mime type
$filename .= '.' . $export_list[$type]['extension'];
$mime_type = $export_list[$type]['mime_type'];
// If dump is going to be compressed, set correct mime_type and add
// compression to extension
if ($compression == 'bzip') {
示例3: define
*/
if (@function_exists('mb_convert_encoding') && strpos(' ' . $lang, 'ja-') && file_exists('./libraries/kanji-encoding.lib.php')) {
require_once './libraries/kanji-encoding.lib.php';
/**
* enable multibyte string support
*/
define('PMA_MULTIBYTE_ENCODING', 1);
}
// end if
/**
* save some settings in cookies
* @todo should be done in PMA_Config
*/
PMA_setCookie('pma_lang', $GLOBALS['lang']);
PMA_setCookie('pma_charset', $GLOBALS['convcharset']);
PMA_setCookie('pma_collation_connection', $GLOBALS['collation_connection']);
$_SESSION['PMA_Theme_Manager']->setThemeCookie();
/**
* check if profiling was requested and remember it
* (note: when $cfg['ServerDefault'] = 0, constant is not defined)
*/
if (PMA_profilingSupported() && isset($_REQUEST['profiling'])) {
$_SESSION['profiling'] = true;
} elseif (isset($_REQUEST['profiling_form'])) {
// the checkbox was unchecked
unset($_SESSION['profiling']);
}
}
// end if !defined('PMA_MINIMUM_COMMON')
// remove sensitive values from session
$_SESSION['PMA_Config']->set('blowfish_secret', '');
示例4: checkFontsize
/**
* checks for font size configuration, and sets font size as requested by user
*
* @uses $_GET
* @uses $_POST
* @uses $_COOKIE
* @uses preg_match()
* @uses function_exists()
* @uses PMA_Config::set()
* @uses PMA_Config::get()
* @uses PMA_setCookie()
*/
function checkFontsize()
{
$new_fontsize = '';
if (isset($_GET['fontsize'])) {
$new_fontsize = $_GET['fontsize'];
} elseif (isset($_POST['fontsize'])) {
$new_fontsize = $_POST['fontsize'];
} elseif (isset($_COOKIE['pma_fontsize'])) {
$new_fontsize = $_COOKIE['pma_fontsize'];
}
if (preg_match('/^[0-9.]+(px|em|pt|\\%)$/', $new_fontsize)) {
$this->set('fontsize', $new_fontsize);
} elseif (!$this->get('fontsize')) {
$this->set('fontsize', '100%');
}
if (function_exists('PMA_setCookie')) {
PMA_setCookie('pma_fontsize', $this->get('fontsize'), '80%');
}
}
示例5: PMA_generate_common_url
}
}
// end if
// here $nopass could be == 1
if (empty($error_msg)) {
// Defines the url to return to in case of error in the sql statement
$common_url_query = PMA_generate_common_url();
$err_url = 'user_password.php?' . $common_url_query;
$hashing_function = (PMA_MYSQL_INT_VERSION >= 40102 && !empty($pw_hash) && $pw_hash == 'old' ? 'OLD_' : '') . 'PASSWORD';
$sql_query = 'SET password = ' . ($pma_pw == '' ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')');
$local_query = 'SET password = ' . ($pma_pw == '' ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($pma_pw) . '\')');
$result = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, FALSE, $err_url);
// Changes password cookie if required
// Duration = till the browser is closed for password (we don't want this to be saved)
if ($cfg['Server']['auth_type'] == 'cookie') {
PMA_setCookie('pmaPass-' . $server, PMA_blowfish_encrypt($pma_pw, $GLOBALS['cfg']['blowfish_secret']));
}
// end if
// For http auth. mode, the "back" link will also enforce new
// authentication
$http_logout = $cfg['Server']['auth_type'] == 'http' ? '&old_usr=relog' : '';
// Displays the page
require_once './libraries/header.inc.php';
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
$show_query = 'y';
PMA_showMessage($strUpdateProfileMessage);
?>
<a href="index.php?<?php
echo $common_url_query . $http_logout;
?>
" target="_parent">
示例6: setThemeCookie
/**
* save theme in cookie
*
* @uses PMA_setCookie();
* @uses PMA_Theme_Manager::getThemeCookieName()
* @uses PMA_Theme_Manager::$theme
* @uses PMA_Theme_Manager::$theme_default
* @uses PMA_Theme::getId()
*/
function setThemeCookie()
{
PMA_setCookie($this->getThemeCookieName(), $this->theme->id, $this->theme_default);
// force a change of a dummy session variable to avoid problems
// with the caching of phpmyadmin.css.php
$_SESSION['PMA_Config']->set('theme-update', $this->theme->id);
return true;
}
示例7: PMA_auth_set_user
/**
* Set the user and password after last checkings if required
*
* @global array the valid servers settings
* @global integer the id of the current server
* @global array the current server settings
* @global string the current username
* @global string the current password
* @global boolean whether the login/password pair has been grabbed from
* a cookie or not
*
* @return boolean always true
*
* @access public
*/
function PMA_auth_set_user()
{
global $cfg, $server;
global $PHP_AUTH_USER, $PHP_AUTH_PW, $pma_auth_server;
global $from_cookie;
// Ensures valid authentication mode, 'only_db', bookmark database and
// table names and relation table name are used
if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
foreach ($cfg['Servers'] as $idx => $current) {
if ($current['host'] == $cfg['Server']['host'] && $current['port'] == $cfg['Server']['port'] && $current['socket'] == $cfg['Server']['socket'] && $current['ssl'] == $cfg['Server']['ssl'] && $current['connect_type'] == $cfg['Server']['connect_type'] && $current['user'] == $PHP_AUTH_USER) {
$server = $idx;
$cfg['Server'] = $current;
break;
}
}
// end foreach
}
// end if
$pma_server_changed = false;
if ($GLOBALS['cfg']['AllowArbitraryServer'] && isset($pma_auth_server) && !empty($pma_auth_server) && $cfg['Server']['host'] != $pma_auth_server) {
$cfg['Server']['host'] = $pma_auth_server;
$pma_server_changed = true;
}
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['password'] = $PHP_AUTH_PW;
// Name and password cookies needs to be refreshed each time
// Duration = one month for username
PMA_setCookie('pma_cookie_username-' . $server, PMA_blowfish_encrypt($cfg['Server']['user'] . ':' . $GLOBALS['current_time'], $GLOBALS['cfg']['blowfish_secret']));
// Duration = as configured
PMA_setCookie('pma_cookie_password-' . $server, PMA_blowfish_encrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "ÿ(blank)", $GLOBALS['cfg']['blowfish_secret'] . $GLOBALS['current_time']), null, $GLOBALS['cfg']['LoginCookieStore']);
// Set server cookies if required (once per session) and, in this case, force
// reload to ensure the client accepts cookies
if (!$from_cookie) {
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
if (isset($pma_auth_server) && !empty($pma_auth_server) && $pma_server_changed) {
// Duration = one month for serverrname
PMA_setCookie('pma_cookie_servername-' . $server, $cfg['Server']['host']);
} else {
// Delete servername cookie
PMA_removeCookie('pma_cookie_servername-' . $server);
}
}
// URL where to go:
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
// any parameters to pass?
$url_params = array();
if (isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
$url_params['db'] = $GLOBALS['db'];
}
if (isset($GLOBALS['table']) && strlen($GLOBALS['table'])) {
$url_params['table'] = $GLOBALS['table'];
}
// Language change from the login panel needs to be remembered
if (!empty($GLOBALS['lang'])) {
$url_params['lang'] = $GLOBALS['lang'];
}
// any target to pass?
if (!empty($GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
$url_params['target'] = $GLOBALS['target'];
}
define('PMA_COMING_FROM_COOKIE_LOGIN', 1);
PMA_sendHeaderLocation($redirect_url . PMA_generate_common_url($url_params, '&'));
exit;
}
// end if
return true;
}
示例8: srand
*
* @version $Id: mcrypt.lib.php 11326 2008-06-17 21:32:48Z lem9 $
*/
if (!defined('PHPMYADMIN')) {
exit;
}
/**
* Initialization
* Store the initialization vector because it will be needed for
* further decryption. I don't think necessary to have one iv
* per server so I don't put the server number in the cookie name.
*/
if (empty($_COOKIE['pma_mcrypt_iv']) || false === ($iv = base64_decode($_COOKIE['pma_mcrypt_iv']))) {
srand((double) microtime() * 1000000);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC), MCRYPT_RAND);
PMA_setCookie('pma_mcrypt_iv', base64_encode($iv));
}
/**
* String padding
*
* @param string input string
* @param integer length of the result
* @param string the filling string
* @param integer padding mode
*
* @return string the padded string
*
* @access public
*/
function full_str_pad($input, $pad_length, $pad_string = '', $pad_type = 0)
{
示例9: PMA_auth_set_user
/**
* Set the user and password after last checkings if required
*
* @uses $GLOBALS['PHP_AUTH_USER']
* @uses $GLOBALS['PHP_AUTH_PW']
* @uses $GLOBALS['server']
* @uses $GLOBALS['from_cookie']
* @uses $GLOBALS['pma_auth_server']
* @uses $cfg['Server']
* @uses $cfg['AllowArbitraryServer']
* @uses $cfg['LoginCookieStore']
* @uses $cfg['PmaAbsoluteUri']
* @uses $_SESSION['last_access_time']
* @uses PMA_COMING_FROM_COOKIE_LOGIN
* @uses PMA_setCookie()
* @uses PMA_blowfish_encrypt()
* @uses PMA_removeCookie()
* @uses PMA_sendHeaderLocation()
* @uses time()
* @uses define()
* @return boolean always true
*
* @access public
*/
function PMA_auth_set_user()
{
global $cfg;
// Ensures valid authentication mode, 'only_db', bookmark database and
// table names and relation table name are used
if ($cfg['Server']['user'] != $GLOBALS['PHP_AUTH_USER']) {
foreach ($cfg['Servers'] as $idx => $current) {
if ($current['host'] == $cfg['Server']['host'] && $current['port'] == $cfg['Server']['port'] && $current['socket'] == $cfg['Server']['socket'] && $current['ssl'] == $cfg['Server']['ssl'] && $current['connect_type'] == $cfg['Server']['connect_type'] && $current['user'] == $GLOBALS['PHP_AUTH_USER']) {
$GLOBALS['server'] = $idx;
$cfg['Server'] = $current;
break;
}
}
// end foreach
}
// end if
if ($GLOBALS['cfg']['AllowArbitraryServer'] && !empty($GLOBALS['pma_auth_server'])) {
/* Allow to specify 'host port' */
$parts = explode(' ', $GLOBALS['pma_auth_server']);
if (count($parts) == 2) {
$tmp_host = $parts[0];
$tmp_port = $parts[1];
} else {
$tmp_host = $GLOBALS['pma_auth_server'];
$tmp_port = '';
}
if ($cfg['Server']['host'] != $GLOBALS['pma_auth_server']) {
$cfg['Server']['host'] = $tmp_host;
if (!empty($tmp_port)) {
$cfg['Server']['port'] = $tmp_port;
}
}
unset($tmp_host, $tmp_port, $parts);
}
$cfg['Server']['user'] = $GLOBALS['PHP_AUTH_USER'];
$cfg['Server']['password'] = $GLOBALS['PHP_AUTH_PW'];
$_SESSION['last_access_time'] = time();
// Name and password cookies need to be refreshed each time
// Duration = one month for username
PMA_setCookie('pmaUser-' . $GLOBALS['server'], PMA_blowfish_encrypt($cfg['Server']['user'], PMA_get_blowfish_secret()));
// Duration = as configured
PMA_setCookie('pmaPass-' . $GLOBALS['server'], PMA_blowfish_encrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "ÿ(blank)", PMA_get_blowfish_secret()), null, $GLOBALS['cfg']['LoginCookieStore']);
// Set server cookies if required (once per session) and, in this case, force
// reload to ensure the client accepts cookies
if (!$GLOBALS['from_cookie']) {
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
if (!empty($GLOBALS['pma_auth_server'])) {
// Duration = one month for servername
PMA_setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']);
} else {
// Delete servername cookie
PMA_removeCookie('pmaServer-' . $GLOBALS['server']);
}
}
// URL where to go:
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
// any parameters to pass?
$url_params = array();
if (strlen($GLOBALS['db'])) {
$url_params['db'] = $GLOBALS['db'];
}
if (strlen($GLOBALS['table'])) {
$url_params['table'] = $GLOBALS['table'];
}
// any target to pass?
if (!empty($GLOBALS['target']) && $GLOBALS['target'] != 'index.php') {
$url_params['target'] = $GLOBALS['target'];
}
/**
* whether we come from a fresh cookie login
*/
define('PMA_COMING_FROM_COOKIE_LOGIN', true);
PMA_sendHeaderLocation($redirect_url . PMA_generate_common_url($url_params, '&'));
exit;
}
// end if
//.........这里部分代码省略.........
示例10: session_write_close
* @uses session_write_close()
* @uses time()
* @uses PMA_getenv()
* @uses header() to send charset
*/
/**
* Gets core libraries and defines some variables
*/
require_once './libraries/common.lib.php';
/**
* Includes the ThemeManager if it hasn't been included yet
*/
require_once './libraries/relation.lib.php';
// free the session file, for the other frames to be loaded
session_write_close();
PMA_setCookie('pma_fontsize', '80%', '80%');
// Gets the host name
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
if (empty($HTTP_HOST)) {
if (PMA_getenv('HTTP_HOST')) {
$HTTP_HOST = PMA_getenv('HTTP_HOST');
} else {
$HTTP_HOST = '';
}
}
// purge querywindow history
$cfgRelation = PMA_getRelationsParam();
if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
PMA_purgeHistory($GLOBALS['cfg']['Server']['user']);
}
unset($cfgRelation);
示例11: PMA_generate_common_url
}
}
// end if
// here $nopass could be == 1
if (empty($error_msg)) {
// Defines the url to return to in case of error in the sql statement
$common_url_query = PMA_generate_common_url();
$err_url = 'user_password.php?' . $common_url_query;
$hashing_function = (PMA_MYSQL_INT_VERSION >= 40102 && !empty($pw_hash) && $pw_hash == 'old' ? 'OLD_' : '') . 'PASSWORD';
$sql_query = 'SET password = ' . ($pma_pw == '' ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')');
$local_query = 'SET password = ' . ($pma_pw == '' ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($pma_pw) . '\')');
$result = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, FALSE, $err_url);
// Changes password cookie if required
// Duration = till the browser is closed for password (we don't want this to be saved)
if ($cfg['Server']['auth_type'] == 'cookie') {
PMA_setCookie('pma_cookie_password-' . $server, PMA_blowfish_encrypt($pma_pw, $GLOBALS['cfg']['blowfish_secret'] . $GLOBALS['current_time']));
}
// end if
// For http auth. mode, the "back" link will also enforce new
// authentication
$http_logout = $cfg['Server']['auth_type'] == 'http' ? '&old_usr=relog' : '';
// Displays the page
require_once './libs/header.inc.php';
echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
$show_query = 'y';
PMA_showMessage($strUpdateProfileMessage);
?>
<a href="index.php?<?php
echo $common_url_query . $http_logout;
?>
" target="_parent">
示例12: define
* @version $Id$
*/
/**
* Do not include full common.
* @ignore
*/
define('PMA_MINIMUM_COMMON', TRUE);
define('PMA_SETUP', TRUE);
chdir('..');
require_once './libraries/common.inc.php';
require_once './libraries/url_generating.lib.php';
require_once './setup/lib/ConfigFile.class.php';
// use default error handler
restore_error_handler();
// Save current language in a cookie, required since we use PMA_MINIMUM_COMMON
PMA_setCookie('pma_lang', $GLOBALS['lang']);
if (!isset($_SESSION['ConfigFile'])) {
$_SESSION['ConfigFile'] = array();
}
// allows for redirection even after sending some data
ob_start();
/**
* Returns value of an element in $array given by $path.
* $path is a string describing position of an element in an associative array,
* eg. Servers/1/host refers to $array[Servers][1][host]
*
* @param string $path
* @param array $array
* @param mixed $default
* @return mixed array element or $default
*/
示例13: setThemeCookie
/**
* save theme in cookie
*
* @uses PMA_setCookie();
* @uses PMA_Theme_Manager::getThemeCookieName()
* @uses PMA_Theme_Manager::$theme
* @uses PMA_Theme_Manager::$theme_default
* @uses PMA_Theme::getId()
*/
function setThemeCookie()
{
PMA_setCookie($this->getThemeCookieName(), $this->theme->id, $this->theme_default);
return true;
}