Page 2 of 2
Re: OpenCart 1.4.2
Posted: Fri Mar 12, 2010 6:27 pm
by Daniel
as for the http_host problem.
Does anyoen see why this won;t work;
$query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE url = '" . $db->escape(HTTP_SERVER) . "' OR url = '" . $db->escape(str_replace('www.', '', HTTP_SERVER)) . "'");
Re: OpenCart 1.4.2
Posted: Fri Mar 12, 2010 8:55 pm
by scot80
Daniel wrote:$query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE url = '" . $db->escape(HTTP_SERVER) . "' OR url = '" . $db->escape(str_replace('www.', '', HTTP_SERVER)) . "'");
Why not just?:
Code: Select all
$query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE url = '" . $db->escape(str_replace('www.', '', HTTP_SERVER)) . "'");
I'm no sql-specialist but if no 'www.' matches were found then the string is returned unaltered.
Re: OpenCart 1.4.2
Posted: Fri Mar 12, 2010 8:55 pm
by Qphoria
Yes scot, you are correct in your fix.
Re: OpenCart 1.4.2
Posted: Fri Mar 12, 2010 10:07 pm
by Daniel
I would prefer that people put www. in the their doman name. if they want to then my fix will work with and without www.
where as scotts example would mean that in the admin the user would not be allowed to be www. in.
i'm right.
Re: OpenCart 1.4.2
Posted: Fri Mar 12, 2010 10:51 pm
by Qphoria
But scots would match the domain regardless.
Your code searches for:
www.domain.com/shop/
or
domain.com/shop/
scots change just searches for
domain.com/shop/
which would already match both cases
Its just redundant. both will work