Status
Not open for further replies.

semprot

Customer
My forum can be accessed by 2 ways :
  1. Domain name (e.g. example.com).
  2. The IP address of that domain name.. (e.g. IP address of example.com which is 1.2.3.4)
I used a plugin similar to Cerberus plugin to allow me to do so

It changes the site's homeurl depends whether my board is accessed by domain or IP address.
  • If accessed by domain >> homeurl is domain.
  • If accessed by IP address >> homeurl is IP address.

Now i want to use guest full cache, and i made this modification to
Code:
/upload/dbtech/vboptimise/includes/class_vboptimise.php

Before :
PHP:
	private static function key_guestcache()
	{
		global $vbulletin, $style;
		static $key;

		if (!$key)
		{
			$key = md5(implode('', @array_merge(array(
				THIS_SCRIPT,
				$_COOKIE[COOKIE_PREFIX . 'userstyleid'],
				$_COOKIE[COOKIE_PREFIX . 'languageid'],
				$vbulletin->options['styleid'],
				((is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8) AND !is_browser('ie', 9) AND !is_browser('ie', 10)) ? 'ie6' : 'other'),
				(($vbulletin->mobile_browser OR $vbulletin->mobile_browser_advanced) ? 'mobile' : 'desktop'),
			), $_REQUEST)));
		}

		return $key;
	}

After :
PHP:
	private static function key_guestcache()
	{
		global $vbulletin, $style;
		static $key;

		if (!$key)
		{
			$key = md5(implode('', @array_merge(array(
				$_SERVER['HTTP_HOST'],/* ------------ i added this ------------ */
				$_SERVER['SERVER_NAME'],/* ------------ i added this ------------ */
				THIS_SCRIPT,
				$_COOKIE[COOKIE_PREFIX . 'userstyleid'],
				$_COOKIE[COOKIE_PREFIX . 'languageid'],
				$vbulletin->options['styleid'],
				((is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8) AND !is_browser('ie', 9) AND !is_browser('ie', 10)) ? 'ie6' : 'other'),
				(($vbulletin->mobile_browser OR $vbulletin->mobile_browser_advanced) ? 'mobile' : 'desktop'),
			), $_REQUEST)));
		}

		return $key;
	}

Am i on the correct road?
If so, maybe it should be put on the next vb optimise update? :)
I think it will help user that has a board that can be accessed from several ways (maybe such as on my situation which is domain & ip address), or just a board that can be accessed from several domains.

Thanks.
 
Last edited:
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Can you tell me if there's a difference between the values of SERVER_NAME and HTTP_HOST when you're accessing it from the IP address?

You can find this by logging in to the admincp with the IP address and checking the PHP Info page.
 
Can you tell me if there's a difference between the values of SERVER_NAME and HTTP_HOST when you're accessing it from the IP address?

You can find this by logging in to the admincp with the IP address and checking the PHP Info page.
Actually it's the same when i accessed from IP address. I was confused so i added both of them. I have not searched on google which one from those 2 is more reliable.
 
From php.net (I looked it up cause I didn't know either :p):
HTTP_HOST'
Contents of the Host: header from the current request, if there is one.

'SERVER_NAME'
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.

I think the most reliable one will be SERVER_NAME alone :)
 
I've implemented the SERVER_NAME inclusion into the release package for 2.5.0 here on DBTech :)
 
Status
Not open for further replies.

Similar threads

Back
Top