Page 2 of 2

Undefined index: HTTP_USER_AGENT

Posted: 30 May 2013, 18:59
by martin123456
This seems to have done it so far viewtopic.php?f=43&p=15540#p15539

Undefined index: HTTP_USER_AGENT

Posted: 30 May 2013, 19:01
by Stoker
martin123456 wrote:The error has come bk but i think i just found the fix so it's being tested.

find and remove

Code: Select all

$browser = $_SERVER['HTTP_USER_AGENT'];
find and remove

Code: Select all

'USER_BROWSER'		=> $browser,
seems to have done it and the mod is still working as it should so far fingers crossed.
Then you wont display browser info.

Im using this atm

Code: Select all

$browser = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';

Undefined index: HTTP_USER_AGENT

Posted: 30 May 2013, 19:09
by martin123456
:lol: did not notice that so trying yours out.

Undefined index: HTTP_USER_AGENT

Posted: 31 May 2013, 14:55
by martin123456
I'm now using this and it shows ip and browser in the 404 also no error's in the acp at all.

Code: Select all

<?php
/** 
*
* @package phpBB3
* @version $Id: error.php,v 1.0 2011/05/31 15:49:44 stoker Exp $
* @copyright (c) 2005 phpBB Group 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* @ignore
*/
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('mods/error');

// Get the avatar
if (!function_exists('get_user_avatar'))
{
   include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}

$base_url = generate_board_url() . '/';
$ip = $_SERVER['REMOTE_ADDR'];
$browser = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
$mode = request_var('mode', '');
switch ($mode)
{
	case '400':
		page_header($user->lang['ERROR_TITLE400']);
		$template->set_filenames(array(
			'body' => 'error/400_body.html')
		);
	break;
	case '401':
		page_header($user->lang['ERROR_TITLE401']);
		$template->set_filenames(array(
			'body' => 'error/401_body.html')
		);
	break;
	case '403':
		page_header($user->lang['ERROR_TITLE403']);
		$template->set_filenames(array(
			'body' => 'error/403_body.html')
		);
	break;
	case '404':
		page_header($user->lang['ERROR_TITLE404']);
		$template->set_filenames(array(
			'body' => 'error/404_body.html')
		);
	break;
	case '500':
		page_header($user->lang['ERROR_TITLE500']);
		$template->set_filenames(array(
			'body' => 'error/500_body.html')
		);
	break;
}

$template->assign_vars(array(
	'S_ERROR_PAGE'		=> true,
	'U_FORUM_BASE'		=> $base_url,
	'USER_AVATAR'		=> get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
	'USERNAME'			=> get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
	'USER_IP'			=> $ip,
	'USER_BROWSER'		=> $browser,
));

page_footer();

?>
i noticed your does not show the browser ? the code above will show both ;)
jhfhj.png

Undefined index: HTTP_USER_AGENT

Posted: 31 May 2013, 15:11
by Stoker
I made a mistake last time I closed Fielzilla :)
But yes, it works with the code from here: viewtopic.php?f=43&t=2387&p=15545#p15542

Undefined index: HTTP_USER_AGENT

Posted: 31 May 2013, 17:44
by martin123456
Stoker wrote:I made a mistake last time I closed Fielzilla :)
:D nub