Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: $_SERVER['HTTP_HOST'] with add-on domains and cpanel  (Read 7513 times)

0 Members and 1 Guest are viewing this topic.

spec1alk

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
$_SERVER['HTTP_HOST'] with add-on domains and cpanel
« on: May 25, 2004, 08:26:11 pm »

In the phpbb.inc.php file there is this code:

Code: [Select]
define('PHPBB_WEB_PATH', '/phpBB/');...
Code: [Select]
// Redirect
function udb_redirect($target)
{
    header('Location: http://' . $_SERVER['HTTP_HOST'] . PHPBB_WEB_PATH . $target);
    exit;
}

Lets say you have 2 domains. ilikecheese.com is your main domain with your webhost that uses cpanel. Now your second domain is ilikeapples.com. You add ilikeapples.com to your account with cpanel's add-on domain tool. This creates a subdomain of ilikeapples.ilikecheese.com and then an alias of ilikeapples.com to your folder /usr/ilikecheese/ilikeapples

When in this situation the $_SERVER['HTTP_HOST'] gets set to ilikeapples.ilikecheese.com instead of ilikeapples.com and this causes your cookies to get all messed up.

I have fixed this situation for my installation by using this code:
Code: [Select]
define('PHPBB_WEB_PATH', 'http://www.ilikeapples.com/phpBB/');...
Code: [Select]
// Redirect
function udb_redirect($target)
{
    header('Location: ' . PHPBB_WEB_PATH . $target);
    exit;
}

Can we have a config var somewhere that disregards the $_SERVER['HTTP_HOST']?

Maybe add to config.inc.php

Code: [Select]
// Server HTTP_HOST
// enter your domain or comment out and use the second example if you do not have virtual roots
$CONFIG['CPG_HTTP_HOST'] =                "http://www.ilikeapples.com/";
//$CONFIG['CPG_HTTP_HOST'] =                $_SERVER['HTTP_HOST'];

what u think?
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.