1
jmass
SSL and Xoops
  • 2004/12/16 18:34

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


I just installed a ssl cert. it is working fine for regular web pages. However, within XOOPS I have some issues. I get a broken lock (indicating a mix of secure and insecure items). When I do this:
// In mainfile.php
// change this line
define('XOOPS_URL', 'http: //www.example.org');
// to the following
define('XOOPS_URL', 'https: //www.example.org');

This works fine to change my whole site to ssl. Bu I only want certian pages to be ssl. So I tried this from another post:
// In mainfile.php
// change this line
define('XOOPS_URL', 'https: //www.example.org');

// to the following
$port = $HTTP_SERVER_VARS['SERVER_PORT'];
if(
$port == "443"){
  
define('XOOPS_URL', 'https: //www.example.org');
} else {
  
define('XOOPS_URL', 'http: //www.example.org');
}

It does not work. Everything comes out http not https. I assume that it is not getting the $port == 443.

Any ideas???

But it does not work.

Any help?

2
jmass
Re: SSL and Xoops
  • 2004/12/18 0:14

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Bump.

3
jmass
Re: SSL and Xoops
  • 2004/12/22 21:58

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


One last bump.

4
Mithrandir
Re: SSL and Xoops

Are you sure that $_SERVER['SERVER_PORT'] is set? Try echoing it out.

What's your server OS? PHP version? Webserver and version?

I am not an SSL expert and really don't know how it works, but you use the login.php that is in the xoops/extras folder, right?

How about defining a constant BEFORE including mainfile.php in that particular login.php? Something like
//new code
define("XOOPS_SSL", 1);

// path to your XOOPS main directory
$path = '/path/to/xoops/directory';

include 
$path.'/mainfile.php';
if (!
defined('XOOPS_ROOT_PATH')) {
    exit();
}

and then in your mainfile.php:

// to the following
if(defined(XOOPS_SSL) && XOOPS_SSL == 1) {
  
define('XOOPS_URL', 'https: //www.example.org');
} else {
  
define('XOOPS_URL', 'http: //www.example.org');
}

Oh - and you DO comment out ALL lines in this, right:
// In mainfile.php
// change this line
define('XOOPS_URL', 'https: //www.example.org');
as you cannot re-define a constant.

5
jmass
Re: SSL and Xoops
  • 2004/12/23 3:50

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Quote:
Are you sure that $_SERVER['SERVER_PORT'] is set? Try echoing it out.

I win the bone head award!

I echoed it out and it was port 433! I had a typo in my Apache config.

All better now. THANKS MITH!!!!!!!