Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

No gold padlock (getenv('HTTPS') solution!


livefooduk

Recommended Posts

My server (and I am not alone in this) does not recognise

$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

So when on an https page all the images are called from the http address so we get no gold padlock and a security alert :cry:

 

I have been working on this a long time but have now got the best solution :D it will only work if you have a different subdomain for your secure pages

eg my main site is livefoodshop.co.uk my secure site is sslreay.com/secure.livefoodshop.co.uk

 

This is for the MS1 release in catalog/includes/aplication_top.php find

// set the type of request (secure or not)

 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

and replace with

// set the type of request (secure or not)

if ($SERVER_NAME  == 'secure.livefoodshop.co.uk') {

   $request_type = 'SSL';

}

obviously change 'secure.livefoodshop.co.uk' to the name of your server :)

Best wishes

Steve

Link to comment
Share on other sites

Whoops!

Didn't realise it was thowing out errors on non SSL pages you need this below the previous code changes

if ($SERVER_NAME  == 'livefoodshop.co.uk') {

   $request_type = 'NONSSL';

}

obviously change 'livefoodshop.co.uk' to the name of your non ssl server address

Best wishes

Steve

Link to comment
Share on other sites

  • 2 weeks later...

Did you put in both statements in catalog/application_top.php ie:

// set the type of request (secure or not)



if ($SERVER_NAME  == 'your.secure.domain.co.uk') {

   $request_type = 'SSL';

}

if ($SERVER_NAME  == 'your.domain.co.uk') {

   $request_type = 'NONSSL';

}

If you did try this. Make a file called test.php and in it put

<?php

//test.php



echo $SERVER_NAME;

?>

upload that to your catalog directory.

Then first call it from your https address (in my case this would be https://sslrelay.com/secure.livefoodshop.co...atalog/test.php and the page will return 'secure.livefoodshop.co.uk' ) that is the server name to put where I have put 'your.secure.domain.co.uk'

 

Then call the same file from your http address (in my case this would be http://www.livefoodshop.co.uk/catalog/test.php and the page will return 'livefoodshop.co.uk' ) that is the server name to put where I have put 'your.domain.co.uk'

 

If both are the same then you will get that error and my method will not work for you :cry:

Best wishes

Steve

Link to comment
Share on other sites

hi guys followed your over thread concerning this

think my server could be misconfiguerd my ssl site is

 

https://www1.securesiteserver.co.uk/thetestbeduk

 

when running the test script the from root as above + /test.php

host name is only

 

www1.securesiteserver.co.uk i apper to have lost my name at he end

 

also when trying to run the script from the the catalog directory i just get an internal error

 

running from normal http://www.thetestbeduk.co.uk/test.php is fine and from /catalog/test.php

 

:?:

Link to comment
Share on other sites

another problem that may not help the sitation using donhost

is the path to the ssl server is diferent than normal

 

eg the path to it's web space when accessed over SSL would be:

 

/fs/home/4/j/o/joebloggs/public_html

where as with normal and setup with in os is jest home/j/o/joebloggs/public_html :!:

Link to comment
Share on other sites

I think this will still work for you if you put this in application_top.php

 

// set the type of request (secure or not) 



if ($SERVER_NAME  == 'www1.securesiteserver.co.uk' ) { 

   $request_type = 'SSL'; 

} 

if ($SERVER_NAME  == 'www.thetestbeduk.co.uk' ) { 

   $request_type = 'NONSSL'; 

}

 

instead of

 

// set the type of request (secure or not) 

 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

Let me know how you get on.

Best wishes

Steve

Link to comment
Share on other sites

tx for reply working fine on thetestbeduk now the sucure site server has been fixed

 

nice one will now be updating all site to ms1 as this is such an easy fix

 

:lol:

Link to comment
Share on other sites

damn after testing would not let me checkout just kept scrolling around

coming back to the shoping cart page tested the log in etc wont hold stores the name but dident seem to send me a cookie

 

have re setup the site and updated aplication top and now have this error from all pages on ssl

 

:cry:

Link to comment
Share on other sites

damn after testing would not let me checkout just kept scrolling around

coming back to the shoping cart page tested the log in etc wont hold stores the name but dident seem to send me a cookie

 

have re setup the site and updated aplication top and now have this error from all pages on ssl

 

:cry: Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /amd/11/fs/home/t/h/thetestbeduk/public_html/catalog/includes/functions/database.php on line 17

 

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /amd/11/fs/home/t/h/thetestbeduk/public_html/catalog/includes/functions/database.php on line 17

Unable to connect to database server!

Link to comment
Share on other sites

another method you can use is

 

<?php if ($HTTPS !='on' ) {

$request_type = 'NONSSL';

} else {

$request_type = 'SSL';

}

 

 

ok changed site and now trying the above on http://www.thetestbeduk.co.uk/catalog/default.php

 

no gold padlock

 

and trying the other on http://www.newcompserve.co.uk/catalog/default.php

has a mind of its own keep getting the error

 

Error!

 

Unable to determine connection method on a link!

 

Known methods: NONSSL SSL

Link to comment
Share on other sites

ok first prob was htaccess file was casing errors with the ssl second prob was me (playing with to sites at once ) not enterint the data correctly (server path for non ssl site now have both site working fine with ssl

 

ms1 is definatly the way to go with shared servers

 

if you have probs check your htaccess file temp remove it to see if it works with out it hope this helps somebody out the

 

tx livefoods :D

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

I am also on 1&1 and have been experiencing similar problems as everyone else in this thread.

 

jchasick wrote:

 

another method you can use is  

 

<?php if ($HTTPS !='on' ) {  

$request_type = 'NONSSL';  

} else {  

$request_type = 'SSL';  

}  

 

This method worked for me but I think it may be slightly incorrect, I belive the request type is the wrong way round:

 

if ($HTTPS !='on' ) { 

$request_type = 'SSL'; 

} else { 

$request_type = 'NONSSL'; 

}

 

This seems to work okay for me, however there may still be a problem after login showing the address details?

 

It needs further testing.

Link to comment
Share on other sites

  • 3 months later...

1and one

sslrelay user

I also tried if ($HTTPS !='on' ) { $request_type = 'SSL';} else {$request_type = 'NONSSL';}

 

it messed up all my images

played around with the config

 

define('HTTP_SERVER', 'http://www.jewellerygalleria.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://sslrelay.com/jewellerygalleria.com'[/size][/size]); // eg, https://localhost - should not be empty for productive servers

 

added this which I did not have before seems ok now

 

cheers

david

 

oh heres the lot if it helps I am going to put the cookie stuff back in Now..

 

define('HTTP_SERVER', 'http://www.jewellerygalleria.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://sslrelay.com/jewellerygalleria.com'); // eg, https://localhost - should not be empty for productive servers

define('ENABLE_SSL', true); // secure webserver for checkout procedure?

define('HTTP_COOKIE_DOMAIN', '');

define('HTTPS_COOKIE_DOMAIN', '');

define('HTTP_COOKIE_PATH', '/catalog/');

define('HTTPS_COOKIE_PATH', '/catalog/');

define('DIR_WS_HTTP_CATALOG', '/catalog/');

define('DIR_WS_HTTPS_CATALOG', '/catalog/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...