Jump to content
xt:Commerce Community Forum

Bilder trotz SSL nur als http


Blaftuni

Recommended Posts

Hallo,

nachdem ich fast das ganze Forum durchsucht hab, hab ich noch keine L?sung gefunden.

Wenn ich meinen Shop ?ber ssl aufrufe (https://www.led1.de/shop) sind alle Bilder als http://..., was zur Folge hat, da? das Schlo? gleich wieder aus geht. Im Admin Bereich hab ich keine Probleme, wenn ich das eine Bild (Werbung) ablehne.

Hab schon alles in der Configure.php versucht, aber es bleibt bei dem Problem. Gibt es nicht irgendeine L?sung f?r das Problem?

Gru?

Sven

Link to comment
Share on other sites

Du kannst den kompletten Shop ?ber SSL laufen lassen, das macht ihn dann allerdings langsamer. Also nicht so gut.

Gab mal ne L?sung f?r den 2er, die hier im Forum beschrieben war. H?ttest du eigentlich ?ber die Suche finden m?ssen.

Aber als Sponsor kannst du ja sonst mal im Sponsorenforum fragen, da kann dir vielleicht eher geholfen werden, weil die Entwickler ja mehr Ahnung davon haben (logisch). :D

Link to comment
Share on other sites

Das kann eigentlich (zumindest f?r die Version 2) gar nicht sein, da die Bilder ?ber relative Links (images/product_images/.....) adressiert werden, also immer im Kontext des gerade aktiven "http(s)"-Protokolls beheimatet sind.

Anders sieht es jedoch bei den Programm-Links aus. Diese werden als absolute Links ausgef?hrt (http(s)://www.meinserver.de/xtcommerce/.....), wobei das SSL-Handling sehr inskonsistent ist. Selbst wenn xtCommerce f?r den Checkout auf das "https"-Protokoll umgeschaltet wurde, sind die meisten Links immer noch "http"-addressiert! Mit der unangenehmen Folge, dass, wenn der Kunde sich z.B. beim Checkout entschlie?t, noch weiter Produkte zu erwerben, er bei den Kategorie- und Produktlinks die verwirrende (Browser-)Meldung erh?lt, dass er dabei ist die gesicherte Umgebung zu verlassen (woraufhin er dann wohl den Shop verl?sst...).

Man kann das allerdings recht leicht beheben, indem man die inc/xtc_href_link.inc.php leicht modifiziert.


function xtc_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

	global $request_type, $session_started, $http_domain, $https_domain;


	$die_error_text = '</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Fehler!</b></font><br><br><b>Der Link ist nicht definiert!<br><br>';

	if (!xtc_not_null($page)) {

 die($die_error_text);

	}

	elseif (ENABLE_SSL == true && (($connection == 'SSL') || (getenv('HTTPS') == '1'))) {

 $link = HTTPS_SERVER . DIR_WS_CATALOG;

	} else {

 $link = HTTP_SERVER . DIR_WS_CATALOG;

	}

Der wichtige Punkt hier ist, dass das "https"-Protokoll nicht nur dann verwendet wird, wenn als "$connection"-Parameter "SSL" ?bergeben wird (was leider sehr inkonsistent gemacht wird), sondern auch dann, wenn das Programm schon mit dem "https"-Protokoll arbeitet (getenv('HTTPS') == '1')! Durch die Codezeile

	elseif (ENABLE_SSL == true && (($connection == 'SSL') || (getenv('HTTPS') == '1'))) {


ist jetzt sicher gestellt, dass die Links immer im passenden Protokoll erstellt werden! Die komplette inc/xtc_href_link.inc.php folgt hier: (Wie immer gilt: Keinerlei Gew?hr auf Richtigkeit des Codes! Zu ?ndernde Original-Routine vorher sichern!)

<?php

/* -----------------------------------------------------------------------------------------

$Id: xtc_href_link.inc.php,v 1.5 2004/04/21 17:55:00 fanta2k Exp $


XT-Commerce - community made shopping

http://www.xt-commerce.com


Copyright (c) 2003 XT-Commerce

-----------------------------------------------------------------------------------------

based on:

(c) 2000-2001 The Exchange Project (earlier name of osCommerce)

(c) 2002-2003 osCommerce(html_output.php,v 1.52 2003/03/19); [url]www.oscommerce.com[/url]

(c) 2003 nextcommerce (xtc_href_link.inc.php,v 1.3 2003/08/13); [url]www.nextcommerce.org[/url]


Released under the GNU General Public License

---------------------------------------------------------------------------------------*/


// The HTML href link wrapper function

function xtc_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

	global $request_type, $session_started, $http_domain, $https_domain;


	$die_error_text = '</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Fehler!</b></font><br><br><b>Der Link ist nicht definiert!<br><br>';

	if (!xtc_not_null($page)) {

 die($die_error_text);

	}

	elseif (ENABLE_SSL == true && (($connection == 'SSL') || (getenv('HTTPS') == '1'))) {

 $link = HTTPS_SERVER . DIR_WS_CATALOG;

	} else {

 $link = HTTP_SERVER . DIR_WS_CATALOG;

	}

	if (xtc_not_null($parameters)) {

 $link .= $page . '?' . $parameters;

 $separator = '&';

	} else {

 $link .= $page;

 $separator = '?';

	}


	while ((substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);


	// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined

	if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {

 if (defined('SID') && xtc_not_null(SID)) {

 	$sid = SID;

 } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {

 	if ($http_domain != $https_domain) {

  $sid = session_name() . '=' . session_id();

 	}

 }

	}


	if (xtc_check_agent()==1) {


 $sid=NULL;


	}

	if (isset($sid)) {

 $link .= $separator . $sid;

	}


	if ((SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {

 while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);


 $link = str_replace('?', '/', $link);

 $link = str_replace('&', '/', $link);

 $link = str_replace('=', '/', $link);

 $separator = '?';

	}


	return $link;

}


function xtc_href_link_admin($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

	global $request_type, $session_started, $http_domain, $https_domain;


	$die_error_text = '</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Fehler!</b></font><br><br><b>Der Link ist nicht definiert!<br><br>';

	if (!xtc_not_null($page)) {

 die($die_error_text);

	}

	elseif (ENABLE_SSL == true && (($connection == 'SSL') || (getenv('HTTPS') == '1'))) {

 $link = HTTPS_SERVER . DIR_WS_CATALOG;

	} else {

 $link = HTTP_SERVER . DIR_WS_CATALOG;

	}

	if (xtc_not_null($parameters)) {

 $link .= $page . '?' . $parameters;

 $separator = '&';

	} else {

 $link .= $page;

 $separator = '?';

	}


	while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);


	// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined

	if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {

 if (defined('SID') && xtc_not_null(SID)) {

 	$sid = SID;

 } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {

 	if ($http_domain != $https_domain) {

  $sid = session_name() . '=' . session_id();

 	}

 }

	}


	if (xtc_check_agent()==1) {


 $sid=NULL;


	}

	if (isset($sid)) {

 $link .= $separator . $sid;

	}



	return $link;

}


 ?>

Link to comment
Share on other sites

Archived

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

×
  • Create New...