本文整理汇总了PHP中header_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP header_redirect函数的具体用法?PHP header_redirect怎么用?PHP header_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了header_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add()
{
$input = array('username' => clear_all($_POST['username']), 'content' => clear_all($_POST['content']), 'pro_id' => intval($_GET['id']));
$this->db->insert_record($this->table, $input);
$this->db->alert(COMMENT_SUCCESS);
header_redirect(change_url(full_url()));
}
示例2: commentwall_init
/**
* Comment wall initialisation.
*/
function commentwall_init()
{
global $CFG, $db, $function, $metatags, $template;
// Add meta tags
$metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/commentwall/commentwall.js\"><!-- commentwall js --></script>";
// Define some templates
templates_add_context('commentwallobject', 'mod/commentwall/template');
templates_add_context('commentwallfooter', 'mod/commentwall/footer');
templates_add_context('css', 'mod/commentwall/css');
// Set up the database
$tables = $db->Metatables();
if (!in_array($CFG->prefix . "commentwall", $tables)) {
if (file_exists($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg commentwall. See the mod/commentwall directory.");
}
print_continue($CFG->wwwroot);
exit;
}
// Add configuration options
$function['userdetails:edit:details'][] = $CFG->dirroot . "mod/commentwall/lib/commentwall_settings.php";
}
示例3: elggadmin_pagesetup
function elggadmin_pagesetup()
{
// first login?
global $CFG;
if (user_flag_get('admin', $_SESSION['userid']) && !isset($CFG->elggadmin_installed)) {
$CFG->elggadmin_installed = true;
set_config('elggadmin_installed', true);
header_redirect(get_url(null, 'elggadmin::config'), __gettext('Welcome to the Elgg configuration manager!'));
}
if (context() == 'admin') {
if (!plugin_is_loaded('pages')) {
elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
} else {
pages_submenu_add('elggadmin', __gettext('Site administration'), get_url(null, 'elggadmin::'), 10);
}
} elseif (context() == 'elggadmin') {
if (!plugin_is_loaded('pages')) {
elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
header_redirect(get_url(null, 'admin::'));
}
// submenu options
pages_submenu_add('elggadmin', __gettext('Configuration manager'), get_url(null, 'elggadmin::'));
pages_submenu_add('elggadmin:theme', __gettext('Default theme editor'), get_url(null, 'elggadmin::theme'));
pages_submenu_add('elggadmin:frontpage', __gettext('Frontpage template editor'), get_url(null, 'elggadmin::frontpage'));
pages_submenu_add('elggadmin:logs', __gettext('Error log'), get_url(null, 'elggadmin::logs'));
sidebar_add(50, 'sidebar-' . elggadmin_currentpage(), elggadmin_sidebar());
// clear sidebar
$clear_sidebar[] = 'sidebar-profile';
$clear_sidebar[] = 'sidebar-' . elggadmin_currentpage();
sidebar_remove($clear_sidebar, true);
if (elggadmin_is_404()) {
header('HTTP/1.0 404 Not Found');
}
}
}
示例4: add
function add()
{
global $sitelink;
$input = array('name' => clear_all($_POST['name']), 'email' => clear_all($_POST['email']), 'subject' => clear_all($_POST['subject']), 'content' => clear_all($_POST['content']), 'date' => date('Y-m-d h:m:s'));
$this->db->insert_record($this->table, $input);
header_redirect($sitelink . $this->module . '/success');
}
示例5: generic_comments_init
function generic_comments_init()
{
global $CFG, $db, $function, $metatags, $template;
$metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/generic_comments/generic_comments.js\"><!-- generic_comments js --></script>";
// create the generic_comments and generic watchlist table
$tables = $db->Metatables();
if (!in_array($CFG->prefix . "comments", $tables) || !in_array($CFG->prefix . "watchlist", $tables)) {
if (file_exists($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg generic comments. See the mod/generic_comments directory.");
}
print_continue("index.php");
exit;
}
$function['comments:init'][] = $CFG->dirroot . "mod/generic_comments/comments_actions.php";
$function['permissions:check'][] = $CFG->dirroot . "mod/generic_comments/permissions_check.php";
// Add annotation support
display_set_display_annotation_function("file::file", "generic_comments_displayobjectannotations");
display_set_display_annotation_function("mediastream::media", "generic_comments_displayobjectannotations");
// Register file river hook (if there)
if (function_exists('river_save_event')) {
river_register_friendlyname_hook('file::file', 'generic_comments_get_friendly_name');
}
templates_add_context('embeddedcomments', 'mod/generic_comments/comments');
templates_add_context('embeddedcomment', 'mod/generic_comments/comment');
templates_add_context('css', 'mod/generic_comments/css', true, false);
}
示例6: install_check
function install_check()
{
if (!file_exists(BH_INCLUDE_PATH . "config.inc.php")) {
header_redirect('./install/index.php');
}
install_check_php_version();
install_check_php_extensions();
install_check_mysql_version();
if (@file_exists('./install/index.php') && !defined("BEEHIVE_DEVELOPER_MODE")) {
install_draw_top();
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"400\">\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo " <table class=\"box\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"posthead\">\n";
echo " <table class=\"posthead\" width=\"500\">\n";
echo " <tr>\n";
echo " <td align=\"left\" colspan=\"2\" class=\"subhead\">Installation Incomplete</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <table class=\"posthead\" width=\"95%\">\n";
echo " <tr>\n";
echo " <td align=\"left\">Your Beehive Forum would appear to be already installed, but you have not removed the installation files. You must delete the 'install' directory before your Beehive Forum can be used.</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <form accept-charset=\"utf-8\" method=\"get\" action=\"index.php\">\n";
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"500\">\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"500\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Retry\" class=\"button\" /></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </form>\n";
install_draw_bottom();
exit;
}
}
示例7: widget_init
function widget_init()
{
global $CFG, $function, $db, $METATABLES;
$function['init'][] = $CFG->dirroot . "mod/widget/init.php";
// Initialise the 'allcontent' widget array - i.e., widgets where Javascript is allowed
if (!isset($CFG->widgets->allcontent)) {
$CFG->widgets->allcontent = array();
}
// register the widgets that this module provides
$CFG->widgets->list[] = array('name' => gettext("Text box"), 'description' => gettext("Displays the text of your choice."), 'type' => "widget::text");
if (!in_array($CFG->prefix . "widget_data", $METATABLES) || !in_array($CFG->prefix . "widgets", $METATABLES)) {
if (file_exists($CFG->dirroot . "mod/widget/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/widget/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg widgets. See the mod/widget directory.");
}
print_continue("index.php");
exit;
}
// Delete users
listen_for_event("user", "delete", "widget_user_delete");
}
示例8: header_redirect
// Redirect so that a reload doesn't write to the DB twice:
header_redirect($redirect_to);
/* EXITED */
break;
case 'remove_report':
// Remove one report on user:
// Check that this action request is not a CSRF hacked request:
$Session->assert_received_crumb('users');
$reporter_ID = param('reporter_ID', 'integer', true);
// Remove the report from DB:
$DB->query('DELETE FROM T_users__reports
WHERE urep_target_user_ID = ' . $DB->quote($edited_User->ID) . '
AND urep_reporter_ID = ' . $DB->quote($reporter_ID));
$Messages->add(T_('The report has been removed!'), 'success');
// Redirect so that a reload doesn't write to the DB twice:
header_redirect($admin_url . '?ctrl=user&user_tab=activity&user_ID=' . $edited_User->ID);
/* EXITED */
break;
}
}
// Used for autocomplete user fields in filter "Specific criteria" or to highlight user level cell on change
require_js('#jqueryUI#');
require_css('#jqueryUI_css#');
// We might delegate to this action from above:
/*if( $action == 'edit' )
{
$Plugins->trigger_event( 'PluginUserSettingsEditAction', $tmp_params = array( 'User' => & $edited_User ) );
$Session->delete( 'core.changepwd.request_id' ); // delete the request_id for password change request (from /htsrv/login.php)
}*/
$AdminUI->breadcrumbpath_init(false);
// fp> I'm playing with the idea of keeping the current blog in the path here...
示例9: param
// Delete user field:
// Check that this action request is not a CSRF hacked request:
$Session->assert_received_crumb('userfieldgroup');
// Check permission:
$current_User->check_perm('users', 'edit', true);
// Make sure we got an ufgp_ID:
param('ufgp_ID', 'integer', true);
if (param('confirm', 'integer', 0)) {
// confirmed, Delete from DB:
$msg = sprintf(T_('User field group «%s» deleted.'), $edited_UserfieldGroup->dget('name'));
$edited_UserfieldGroup->dbdelete(true);
unset($edited_UserfieldGroup);
forget_param('ufgp_ID');
$Messages->add($msg, 'success');
// Redirect so that a reload doesn't write to the DB twice:
header_redirect('?ctrl=userfields', 303);
// Will EXIT
// We have EXITed already at this point!!
} else {
// not confirmed, Check for restrictions:
if (!$edited_UserfieldGroup->check_delete(sprintf(T_('Cannot delete user field group «%s»'), $edited_UserfieldGroup->dget('name')))) {
// There are restrictions:
$action = 'view';
}
}
break;
}
$AdminUI->breadcrumbpath_init(false);
// fp> I'm playing with the idea of keeping the current blog in the path here...
$AdminUI->breadcrumbpath_add(T_('Users'), '?ctrl=users');
$AdminUI->breadcrumbpath_add(T_('Settings'), '?ctrl=usersettings');
示例10: trim
} else {
$user_prefs['PM_NOTIFY_EMAIL'] = "N";
}
if (isset($_POST['anon_logon']) && is_numeric($_POST['anon_logon'])) {
$user_prefs['ANON_LOGON'] = $_POST['anon_logon'];
} else {
$user_prefs['ANON_LOGON'] = 0;
}
if (isset($_POST['dob_display'])) {
$user_prefs['DOB_DISPLAY'] = trim($_POST['dob_display']);
} else {
$user_prefs['DOB_DISPLAY'] = 0;
}
// Update USER_PREFS
if (user_update_prefs($_SESSION['UID'], $user_prefs, $user_prefs_global)) {
header_redirect("edit_email.php?webtag={$webtag}&updated=true");
exit;
} else {
$error_msg_array[] = gettext("Some or all of your user account details could not be updated. Please try again later.");
$valid = false;
}
}
// Check to see if we should show the set for all forums checkboxes
$show_set_all = forums_get_available_count() > 1 ? true : false;
html_draw_top(array('title' => gettext('My Controls - Email & Privacy'), 'class' => 'window_title', 'js' => array('js/prefs.js')));
echo "<h1>", htmlentities_array(gettext("Email & Privacy")), "</h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
html_display_error_array($error_msg_array, '700', 'left');
} else {
if (isset($_GET['updated'])) {
html_display_success_msg(gettext("Preferences were successfully updated."), '700', 'left');
示例11: skin_404_header
/**
* Sends the desired HTTP response header in case of a "404".
*/
function skin_404_header()
{
global $Blog;
// We have a 404 unresolved content error
// How do we want do deal with it?
switch ($resp_code = $Blog->get_setting('404_response')) {
case '404':
header_http_response('404 Not Found');
break;
case '410':
header_http_response('410 Gone');
break;
case '301':
case '302':
case '303':
// Redirect to home page:
header_redirect($Blog->get('url'), intval($resp_code));
// THIS WILL EXIT!
break;
default:
// Will result in a 200 OK
}
}
示例12: die
*
* @todo iTunes podcast tags: http://www.apple.com/itunes/store/podcaststechspecs.html
* Note: itunes support: .m4a, .mp3, .mov, .mp4, .m4v, and .pdf.
*
* @package evoskins
* @subpackage rss
*
* @version $Id: index.main.php 3157 2013-03-06 04:34:44Z fplanque $
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
// EXTERNAL FEED PROVIDER?
$rss2_redirect = $Blog->get_setting('rss2_redirect');
if (!empty($rss2_redirect) && empty($Chapter) && $redir == 'yes') {
header_redirect($rss2_redirect, 301);
exit(0);
}
// Note: even if we request the same post as $Item earlier, the following will do more restrictions (dates, etc.)
// Init the MainList object:
init_MainList($Blog->get_setting('posts_per_feed'));
// What level of detail do we want?
$feed_content = $Blog->get_setting('feed_content');
if ($feed_content == 'none') {
// We don't want to provide this feed!
// This will normaly have been detected earlier but just for security:
debug_die('Feeds are disabled.');
}
$image_size = $Blog->get_setting('image_size');
headers_content_mightcache('application/xml');
// In most situations, you do NOT want to cache dynamic content!
示例13: html_guest_error
html_guest_error();
}
$error_msg_array = array();
if (isset($_POST['save'])) {
$valid = true;
if (isset($_POST['set_interest']) && is_array($_POST['set_interest'])) {
foreach ($_POST['set_interest'] as $folder) {
if ($valid && is_numeric($folder) && ($folder_title = folder_get_title($folder))) {
if (!user_set_folder_interest($folder, 0)) {
$error_msg_array[] = sprintf(gettext("Could not update interest on folder '%s'"), $folder_title);
$valid = false;
}
}
}
if ($valid) {
header_redirect("folder_subscriptions.php?webtag={$webtag}&updated=true");
exit;
}
}
}
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
$page = $_GET['page'];
} else {
if (isset($_POST['page']) && is_numeric($_POST['page'])) {
$page = $_POST['page'];
} else {
$page = 1;
}
}
if (isset($_GET['view']) && is_numeric($_GET['view'])) {
$view = $_GET['view'];
示例14: header_redirect
$tg2 = $ca[$i];
$arr[$i] = $arr[$j];
$ca[$i] = $ca[$j];
$arr[$j] = $tg1;
$ca[$j] = $tg2;
}
}
}
$image = $list_cards['image'];
$type_name = $list_cards['name'];
$featured = $list_cards['featured'];
$_SESSION['f'] = $list_cards['featured'];
$header_text = $list_cards['header_text'];
$footer_text = $list_cards['footer_text'];
} else {
header_redirect($sitelink);
}
if (count($ca) > 0) {
$top_list_names = "";
$head_name = $list_cards['head_name'] ? $list_cards['head_name'] : $type_name;
if ($list_cards['top_type_name'] && $list_cards['top_list']) {
$top_list_names = array_combine(explode(",", $list_cards['top_list']), explode("@||@|@", $list_cards['top_type_name']));
}
?>
<div class=card_pg_contain>
<div class="content-khongbiet">
<?php
$extraie1 = $extraie2 = $extraie3 = "";
if ($matchcase) {
示例15: gettext
if (isset($_POST['prune_log'])) {
$valid = true;
if (isset($_POST['remove_type']) && is_numeric($_POST['remove_type'])) {
$remove_type = $_POST['remove_type'];
} else {
$error_msg_array[] = gettext("You must specify an action type to remove");
$valid = false;
}
if (isset($_POST['remove_days']) && is_numeric($_POST['remove_days'])) {
$remove_days = $_POST['remove_days'];
} else {
$remove_days = 0;
}
if ($valid) {
if (admin_prune_log($remove_type, $remove_days)) {
header_redirect("admin_viewlog.php?webtag={$webtag}&sort_dir={$sort_dir}&sort_by={$sort_by}&group_by={$group_by}&pruned=true");
exit;
} else {
$error_msg_array[] = gettext("Failed To Prune Admin Log");
$valid = false;
}
}
}
html_draw_top(array('title' => gettext('Admin - Admin Access Log'), 'class' => 'window_title', 'main_css' => 'admin.css'));
$admin_log_array = admin_get_log_entries($page, $group_by, $sort_by, $sort_dir);
echo "<h1>", gettext("Admin"), html_style_image('separator'), gettext("Admin Access Log"), "</h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
html_display_error_array($error_msg_array, '86%', 'center');
} else {
if (isset($_GET['pruned'])) {
html_display_success_msg(gettext("Successfully Pruned Admin Log"), '86%', 'center');