提交按钮后的空白页面和匿名列在提交按钮后更新
Blank page after submit button & Anonymous column is updated after submit button
当我按下提交按钮时,它会将我重定向到一个空白页面。我希望它重定向到 home.php。如果 GUEST 按下提交按钮,则在数据库中更新 ANONYMOUS 列。如果未连接,如何将访客重定向到登录表单?这是我的代码:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$submit = request_var('submit', '');
if($submit)
{
$sql_ary = array("server"=> 3);
$sql = 'UPDATE ' . 'phpbb5u_users' . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
}
重定向来宾登录使用会话:
if (!isset($_SESSION['login'])) {
header("Location: login.php");
}
来自文档
https://www.phpbb.com/support/docs/en/3.2/kb/article/phpbb3-sessions-integration
您需要在首页添加此代码
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
现在验证客人是否提交数据
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
header("Location: loginform.php");
// EXECUTE YOUR SQL QUERY UPDATE HERE
}
else
{
header("Location: home.php");
}
当我按下提交按钮时,它会将我重定向到一个空白页面。我希望它重定向到 home.php。如果 GUEST 按下提交按钮,则在数据库中更新 ANONYMOUS 列。如果未连接,如何将访客重定向到登录表单?这是我的代码:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$submit = request_var('submit', '');
if($submit)
{
$sql_ary = array("server"=> 3);
$sql = 'UPDATE ' . 'phpbb5u_users' . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
}
重定向来宾登录使用会话:
if (!isset($_SESSION['login'])) {
header("Location: login.php");
}
来自文档 https://www.phpbb.com/support/docs/en/3.2/kb/article/phpbb3-sessions-integration
您需要在首页添加此代码
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
现在验证客人是否提交数据
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
header("Location: loginform.php");
// EXECUTE YOUR SQL QUERY UPDATE HERE
}
else
{
header("Location: home.php");
}