141
nekro
XOOPS under SSL
  • 2006/7/14 13:35

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


I had to use XOOPS under ssl every time soo.. i realiced a hack to do it..

1- In mainfile.php just before the license put:



//<<< SSL PATCH >>>

if ( $_SERVER["SERVER_PORT"] == 80 ){

define('XOOPS_HTTP_METHOD', 'http');

}else{

define('XOOPS_HTTP_METHOD', 'https');

}

//<<< SSL PATCH >>>



You also habe to modify the line 39 from the mainfile.php



define('XOOPS_URL', 'http://THESITEURL');



with:



//<<< SSL PATCH >>>

define('XOOPS_URL', XOOPS_HTTP_METHOD.'://THESITEURL');

//<<< SSL PATCH >>>



Those lines changes that if the petition was under ssl .. . every URL link will be in SSL (HTTPS)
.


2- On header.php just before the licese you have to insert:



//<<< PARCHE SSL >>>

$secure_page = array();

$secure_page[1] = "/user.php";

$secure_page[2] = "/register.php";



if ( !$_SERVER["HTTPS"] && array_search( $_SERVER["REQUEST_URI"] , $secure_page ) != false ){

header("Location:https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);

}

//<<< PARCHE SSL >>>



On include/common.php change the next lines:



if (!empty($_SESSION['xoopsUserId'])) {

$xoopsUser =& $member_handler->getUser($_SESSION['xoopsUserId']);

if (!is_object($xoopsUser)) {

$xoopsUser = '';

$_SESSION = array();

} else {

if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {

setcookie($xoopsConfig['session_name'], session_id(), time()+(60*$xoopsConfig['session_expire']), '/', '', 0);

}

$xoopsUser->setGroups($_SESSION['xoopsUserGroups']);

$xoopsUserIsAdmin = $xoopsUser->isAdmin();

}

}





with:



//<<< PARCHE SSL >>>

if (!empty($_SESSION['xoopsUserId']) ) {

if ( !$_SERVER["HTTPS"] && $_SESSION['xoopsSessionSSL'] != "" ){

header("Location:https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);

}

if( $_SERVER["HTTPS"] && $_SESSION['xoopsSessionSSL'] == "" ){

header("Location:http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);

}

$xoopsUser =& $member_handler->getUser($_SESSION['xoopsUserId']);

if (!is_object($xoopsUser)) {

$xoopsUser = '';

$_SESSION = array();

} else {

if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {

setcookie($xoopsConfig['session_name'], session_id(), time()+(60*$xoopsConfig['session_expire']), '/', '', 0);

}

$xoopsUser->setGroups($_SESSION['xoopsUserGroups']);

}

}else{

if ( $_SERVER["HTTPS"] && $_SERVER["REQUEST_URI"] != "/user.php" && $_SERVER["REQUEST_URI"] != "/register.php" && $_SERVER["REQUEST_URI"] != "/modules/profile/register.php"){

header("Location:http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);

}

}

//<<< PARCHE SSL >>>





4- You also have to change 3 files to have the option too login under SSL mode or not.



/include/checklogin.php

/modules/templates/blocks/system_block_login.html

/modules/templates/system_userform.html



LUCK ... correct me... and sorry for my english.



142
nekro
Re: SSL problems
  • 2006/6/22 15:11

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


really i dont now... and i dont undestand why the XOOPS SSL login doesn t work



143
nekro
Re: SSL problems
  • 2006/6/22 14:50

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


let me now if i undestand your last problem...

you want your site in HTTPS mode and non in HTTP... you dont care what the user types in the browser...http://yoursite.com orhttps://yoursite.com allways in HTTPS.

try to put this lines in the mainfile.php

if( !$_SERVER["HTTPS"] ){
header("Location:https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
}

luck!



144
nekro
Re: Ask for help with SSL
  • 2006/6/22 13:55

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


is somebody there??



145
nekro
Re: Trouble implementing SSL login
  • 2006/6/22 13:53

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


sorry... you have to copy this lines ... in the mainfile.php



146
nekro
Re: Compiling C in Ubuntu
  • 2006/6/21 22:26

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


you have to install any compiler...

use the synaptic or try to do

apt-get install gcc



147
nekro
Ask for help with SSL
  • 2006/6/21 22:17

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


I cant find were is defined the XOOPS url variable for the system block login.html.

The idea is to logon users allways with SSL from the login Block. I dont want the users to make an extra click to logon with SSL.



148
nekro
Re: 2 years of trying
  • 2006/6/21 22:04

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


if you can read spanish or just interpretate it... here is a link were teachs you step by step Spanish Complete XOOPS Installation Tutorial .
I think that everyone would could understand it with a little of work



149
nekro
Re: Installation problem
  • 2006/6/21 21:53

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


xoops/index.html ??? were is exactly that page???

http://yoursite/xoops/index.html

or

httd://yoursite/index.html ???

both are wrong!

... maybe is checking your main url (http://yoursite) and your apache founds first index.html and later index.php so apache reads index.html.

luck



150
nekro
Re: Trouble implementing SSL login
  • 2006/6/21 21:42

  • nekro

  • Quite a regular

  • Posts: 213

  • Since: 2005/11/9


Here is the solution ...

if ( !$_SERVER["HTTPS"] ){
define('XOOPS_HTTP_METHOD', 'http');
}else{
define('XOOPS_HTTP_METHOD', 'https');
}

and ...

define('XOOPS_URL', XOOPS_HTTP_METHOD.'://your.site');

The problem was that XOOPS defines:

define('XOOPS_URL', 'http://your.site');

so all the actions of the forms will have http instead https, that hack will fix that problem.

Now if you ask forhttps://your.xoops.site you will be allways in https mode.




TopTop
« 1 ... 12 13 14 (15)



Login

Who's Online

178 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 178


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits