本文整理汇总了PHP中PMA_sendHeaderLocation函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_sendHeaderLocation函数的具体用法?PHP PMA_sendHeaderLocation怎么用?PHP PMA_sendHeaderLocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_sendHeaderLocation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*
* @access public
*/
function PMA_auth()
{
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
exit;
}
if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {
if (empty($GLOBALS['cfg']['Server']['verbose'])) {
$server_message = $GLOBALS['cfg']['Server']['host'];
} else {
$server_message = $GLOBALS['cfg']['Server']['verbose'];
}
$realm_message = 'phpMyAdmin ' . $server_message;
} else {
$realm_message = $GLOBALS['cfg']['Server']['auth_http_realm'];
}
// remove non US-ASCII to respect RFC2616
$realm_message = preg_replace('/[^\\x20-\\x7e]/i', '', $realm_message);
header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
header('HTTP/1.0 401 Unauthorized');
if (php_sapi_name() !== 'cgi-fcgi') {
header('status: 401 Unauthorized');
}
// Defines the charset to be used
header('Content-Type: text/html; charset=utf-8');
/* HTML header */
$page_title = __('Access denied');
include './libraries/header_meta_style.inc.php';
?>
</head>
<body>
<?php
if (file_exists(CUSTOM_HEADER_FILE)) {
include CUSTOM_HEADER_FILE;
}
?>
<br /><br />
<center>
<h1><?php
echo sprintf(__('Welcome to %s'), ' phpMyAdmin');
?>
</h1>
</center>
<br />
<?php
PMA_Message::error(__('Wrong username/password. Access denied.'))->display();
if (file_exists(CUSTOM_FOOTER_FILE)) {
include CUSTOM_FOOTER_FILE;
}
?>
</body>
</html>
<?php
exit;
}
示例2: PMA_auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*
* @access public
*/
function PMA_auth()
{
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
exit;
}
if (empty($GLOBALS['cfg']['Server']['verbose'])) {
$server_message = $GLOBALS['cfg']['Server']['host'];
} else {
$server_message = $GLOBALS['cfg']['Server']['verbose'];
}
// remove non US-ASCII to respect RFC2616
$server_message = preg_replace('/[^\\x20-\\x7e]/i', '', $server_message);
header('WWW-Authenticate: Basic realm="phpMyAdmin ' . $server_message . '"');
header('HTTP/1.0 401 Unauthorized');
if (php_sapi_name() !== 'cgi-fcgi') {
header('status: 401 Unauthorized');
}
// Defines the charset to be used
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
/* HTML header */
$page_title = $GLOBALS['strAccessDenied'];
require './libraries/header_meta_style.inc.php';
?>
</head>
<body>
<?php
if (file_exists('./config.header.inc.php')) {
require './config.header.inc.php';
}
?>
<br /><br />
<center>
<h1><?php
echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION);
?>
</h1>
</center>
<br />
<div class="warning"><?php
echo $GLOBALS['strWrongUser'];
?>
</div>
<?php
if (file_exists('./config.footer.inc.php')) {
require './config.footer.inc.php';
}
?>
</body>
</html>
<?php
exit;
}
示例3: PMA_auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*
* @access public
*/
function PMA_auth() {
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
PMA_fatalError('You must set SignonURL!');
} elseif (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
/* Perform logout to custom URL */
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
} else {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
}
exit();
} // end of the 'PMA_auth()' function
示例4: PMA_auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*
* @access public
*/
function PMA_auth()
{
unset($_SESSION['LAST_SIGNON_URL']);
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
PMA_fatalError('You must set SignonURL!');
} elseif (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
/* Perform logout to custom URL */
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
} else {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
}
exit;
}
示例5: authForm
/**
* Displays authentication form
*
* @return boolean
*/
public function authForm()
{
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
}
}
if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {
if (empty($GLOBALS['cfg']['Server']['verbose'])) {
$server_message = $GLOBALS['cfg']['Server']['host'];
} else {
$server_message = $GLOBALS['cfg']['Server']['verbose'];
}
$realm_message = 'phpMyAdmin ' . $server_message;
} else {
$realm_message = $GLOBALS['cfg']['Server']['auth_http_realm'];
}
$response = Response::getInstance();
// remove non US-ASCII to respect RFC2616
$realm_message = preg_replace('/[^\\x20-\\x7e]/i', '', $realm_message);
$response->header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
$response->header('HTTP/1.0 401 Unauthorized');
if (php_sapi_name() !== 'cgi-fcgi') {
$response->header('status: 401 Unauthorized');
}
/* HTML header */
$footer = $response->getFooter();
$footer->setMinimal();
$header = $response->getHeader();
$header->setTitle(__('Access denied!'));
$header->disableMenuAndConsole();
$header->setBodyId('loginform');
$response->addHTML('<h1>');
$response->addHTML(sprintf(__('Welcome to %s'), ' phpMyAdmin'));
$response->addHTML('</h1>');
$response->addHTML('<h3>');
$response->addHTML(Message::error(__('Wrong username/password. Access denied.')));
$response->addHTML('</h3>');
if (@file_exists(CUSTOM_FOOTER_FILE)) {
include CUSTOM_FOOTER_FILE;
}
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
}
}
示例6: auth
/**
* Displays authentication form
*
* @return boolean always true (no return indeed)
*/
public function auth()
{
unset($_SESSION['LAST_SIGNON_URL']);
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
PMA_fatalError('You must set SignonURL!');
} else {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
}
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
}
}
示例7: auth
/**
* Displays authentication form
*
* @global string the font face to use in case of failure
* @global string the default font size to use in case of failure
* @global string the big font size to use in case of failure
*
* @return boolean always true (no return indeed)
*/
public function auth()
{
/* Perform logout to custom URL */
if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
exit;
}
if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {
if (empty($GLOBALS['cfg']['Server']['verbose'])) {
$server_message = $GLOBALS['cfg']['Server']['host'];
} else {
$server_message = $GLOBALS['cfg']['Server']['verbose'];
}
$realm_message = 'phpMyAdmin ' . $server_message;
} else {
$realm_message = $GLOBALS['cfg']['Server']['auth_http_realm'];
}
// remove non US-ASCII to respect RFC2616
$realm_message = preg_replace('/[^\\x20-\\x7e]/i', '', $realm_message);
header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
header('HTTP/1.0 401 Unauthorized');
if (php_sapi_name() !== 'cgi-fcgi') {
header('status: 401 Unauthorized');
}
/* HTML header */
$response = PMA_Response::getInstance();
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->setTitle(__('Access denied'));
$header->disableMenu();
echo '
<br /><br />
<center>
<h1>';
echo sprintf(__('Welcome to %s'), ' phpMyAdmin');
echo ' </h1>
</center>
<br />' . PMA_Message::error(__('Wrong username/password. Access denied.'))->display();
if (file_exists(CUSTOM_FOOTER_FILE)) {
include CUSTOM_FOOTER_FILE;
}
exit;
}
示例8: logOut
/**
* Perform logout
*
* @return void
*/
public function logOut()
{
global $PHP_AUTH_USER, $PHP_AUTH_PW;
/* Obtain redirect URL (before doing logout) */
if (!empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
$redirect_url = $GLOBALS['cfg']['Server']['LogoutURL'];
} else {
$redirect_url = $this->getLoginFormURL();
}
/* Clear credentials */
$PHP_AUTH_USER = '';
$PHP_AUTH_PW = '';
/* delete user's choices that were stored in session */
$_SESSION = array();
if (!defined('TESTSUITE')) {
session_destroy();
}
/* Redirect to login form (or configured URL) */
PMA_sendHeaderLocation($redirect_url);
}
示例9: PMA_BS_DropTables
PMA_BS_DropTables($db);
}
break;
// repair BLOB repository
// repair BLOB repository
case "repair":
// check if a blobstreaming table is missing
foreach ($bs_tables as $table_key => $tbl) {
if (!$bs_tables[$table_key]['Exists']) {
PMA_DBI_select_db($db);
PMA_DBI_query(PMA_BS_GetTableStruct($table_key));
}
}
}
// refresh side menu
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_operations.php?' . PMA_generate_common_url('', '', '&') . (isset($db) ? '&db=' . urlencode($db) : '') . (isset($token) ? '&token=' . urlencode($token) : '') . (isset($goto) ? '&goto=' . urlencode($goto) : '') . 'reload=1&purge=1');
}
// end if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
}
// end if ($PMA_Config->get('PBXT_NAME') !== strtolower($db))
}
}
/**
* Settings for relations stuff
*/
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
/**
* Check if comments were updated
* (must be done before displaying the menu tabs)
*/
示例10: testSendHeaderLocationIisLongUri
/**
* Test for PMA_sendHeaderLocation
*
* @return void
*/
public function testSendHeaderLocationIisLongUri()
{
if (defined('PMA_IS_IIS') && PMA_HAS_RUNKIT) {
runkit_constant_redefine('PMA_IS_IIS', true);
} elseif (!defined('PMA_IS_IIS')) {
define('PMA_IS_IIS', true);
} else {
$this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
}
// over 600 chars
$testUri = 'http://testurl.com/test.php?testlonguri=over600chars&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test&test=test&test=test&test=test&test=test' . '&test=test&test=test';
$testUri_html = htmlspecialchars($testUri);
$testUri_js = PMA_escapeJsString($testUri);
$header = "<html><head><title>- - -</title>\n <meta http-equiv=\"expires\" content=\"0\">" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">" . "<meta http-equiv=\"Cache-Control\" content=\"no-cache\">" . "<meta http-equiv=\"Refresh\" content=\"0;url=" . $testUri_html . "\">" . "<script type=\"text/javascript\">//<![CDATA[\n setTimeout(\"window.location = decodeURI('" . $testUri_js . "')\", 2000);\n //]]></script></head>\n<body><script type=\"text/javascript\">//<![CDATA[\n document.write('<p><a href=\"" . $testUri_html . "\">" . __('Go') . "</a></p>');\n //]]></script></body></html>";
$this->expectOutputString($header);
PMA_sendHeaderLocation($testUri);
}
示例11: parse_url
// Parse current URL
$parsed = parse_url($url);
// In case parsing has failed do stupid string replacement
if ($parsed === false) {
// Replace http protocol
$url = preg_replace('@^http:@', 'https:', $url);
} else {
if ($GLOBALS['PMA_Config']->get('SSLPort')) {
$port_number = $GLOBALS['PMA_Config']->get('SSLPort');
} else {
$port_number = 443;
}
$url = 'https://' . $parsed['host'] . ':' . $port_number . $parsed['path'];
}
// Actually redirect
PMA_sendHeaderLocation($url . PMA_generate_common_url($_GET, 'text'));
// delete the current session, otherwise we get problems (see bug #2397877)
$GLOBALS['PMA_Config']->removeCookie($GLOBALS['session_name']);
exit;
}
/**
* include session handling after the globals, to prevent overwriting
*/
require './libraries/session.inc.php';
/**
* init some variables LABEL_variables_init
*/
/**
* holds parameters to be passed to next page
* @global array $GLOBALS['url_params']
*/
示例12: storeUserCredentials
/**
* Stores user credentials after successful login.
*
* @return void|bool
*/
public function storeUserCredentials()
{
global $cfg;
$this->createIV();
// Name and password cookies need to be refreshed each time
// Duration = one month for username
$this->storeUsernameCookie($cfg['Server']['user']);
// Duration = as configured
$this->storePasswordCookie($cfg['Server']['password']);
// 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
$GLOBALS['PMA_Config']->setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']);
} else {
// Delete servername cookie
$GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $GLOBALS['server']);
}
}
// URL where to go:
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
// any parameters to pass?
$url_params = array();
if (mb_strlen($GLOBALS['db'])) {
$url_params['db'] = $GLOBALS['db'];
}
if (mb_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'];
}
/**
* Clear user cache.
*/
PMA_Util::clearUserCache();
PMA_Response::getInstance()->disable();
PMA_sendHeaderLocation($redirect_url . PMA_URL_getCommon($url_params, 'text'), true);
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
}
}
// end if
return true;
}
示例13: PMA_sendHeaderLocation
if (isset($message)) {
$uri_params['message'] = $message;
}
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php' . PMA_generate_common_url($uri_params, '&'));
exit;
}
// Not a valid table name -> back to the default db_details sub-page
if (isset($table) && strlen($table)) {
$is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', null, PMA_DBI_QUERY_STORE);
}
if (!isset($table) || !strlen($table) || !($is_table && PMA_DBI_num_rows($is_table))) {
$uri_params = array('reload' => '1', 'db' => $db);
if (isset($message)) {
$uri_params['message'] = $message;
}
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . $cfg['DefaultTabDatabase'] . PMA_generate_common_url($uri_params, '&'));
exit;
} elseif (isset($is_table)) {
PMA_DBI_free_result($is_table);
}
// Displays headers (if needed)
$js_to_run = isset($index) && isset($do_save_data) ? 'functions.js' : 'indexes.js';
require_once './libraries/header.inc.php';
}
// end if
/**
* Gets fields and indexes informations
*/
if (!defined('PMA_IDX_INCLUDED')) {
$err_url_0 = 'db_details.php?' . PMA_generate_common_url($db);
}
示例14: array
$response = PMA_Response::getInstance();
if ($response->isAjax()) {
$response->setRequestStatus(false);
$response->addJSON('message', PMA_Message::error(__('No databases selected.')));
} else {
$url_params = array('reload' => 1);
if (isset($message)) {
$url_params['message'] = $message;
}
if (!empty($sql_query)) {
$url_params['sql_query'] = $sql_query;
}
if (isset($show_as_php)) {
$url_params['show_as_php'] = $show_as_php;
}
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'index.php' . PMA_URL_getCommon($url_params, 'text'));
}
exit;
}
}
}
// end if (ensures db exists)
if (empty($is_table) && !defined('PMA_SUBMIT_MULT') && !defined('TABLE_MAY_BE_ABSENT')) {
// Not a valid table name -> back to the db_sql.php
if (mb_strlen($table)) {
$is_table = $GLOBALS['dbi']->getCachedTableContent("{$db}.{$table}", false);
if (!$is_table) {
$_result = $GLOBALS['dbi']->tryQuery('SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\';', null, PMA_DatabaseInterface::QUERY_STORE);
$is_table = @$GLOBALS['dbi']->numRows($_result);
$GLOBALS['dbi']->freeResult($_result);
}
示例15: PMA_addBookmark
/**
* Function to add a bookmark
*
* @param String $pmaAbsoluteUri absolute URI
* @param String $goto goto page URL
*
* @return void
*/
function PMA_addBookmark($pmaAbsoluteUri, $goto)
{
$result = PMA_Bookmark_save($_POST['bkm_fields'], isset($_POST['bkm_all_users']) && $_POST['bkm_all_users'] == 'true' ? true : false);
$response = PMA_Response::getInstance();
if ($response->isAjax()) {
if ($result) {
$msg = PMA_message::success(__('Bookmark %s has been created.'));
$msg->addParam($_POST['bkm_fields']['bkm_label']);
$response->addJSON('message', $msg);
} else {
$msg = PMA_message::error(__('Bookmark not created!'));
$response->isSuccess(false);
$response->addJSON('message', $msg);
}
exit;
} else {
// go back to sql.php to redisplay query; do not use & in this case:
/**
* @todo In which scenario does this happen?
*/
PMA_sendHeaderLocation($pmaAbsoluteUri . $goto . '&label=' . $_POST['bkm_fields']['bkm_label']);
}
}