Post by Daniel » Fri Mar 12, 2010 6:27 pm

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)) . "'");

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by scot80 » Fri Mar 12, 2010 8:55 pm

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.
Last edited by scot80 on Fri Mar 12, 2010 8:55 pm, edited 1 time in total.

Active Member

Posts

Joined
Fri Nov 06, 2009 12:14 am
Location - Germany

Post by Qphoria » Fri Mar 12, 2010 8:55 pm

Yes scot, you are correct in your fix.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daniel » Fri Mar 12, 2010 10:07 pm

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.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Qphoria » Fri Mar 12, 2010 10:51 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 10 guests