Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7771

Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail
From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script?
Date Tue, 11 Dec 2012 17:26:43 +0100
Lines 41
Message-ID <aip563Ft79lU1@mid.uni-berlin.de> (permalink)
References <9hExs.680858$YJ1.190681@fx09.am4>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 7n2D6w6c8YovfeITmAzyPgulWq3A0C1YFcsDbfppnTIymKY1P6Egl125m01HtklHU=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
In-Reply-To <9hExs.680858$YJ1.190681@fx09.am4>
Xref csiph.com comp.lang.php:7771

Show key headers only | View raw


Am 11.12.2012 11:53, schrieb Tony Marston:
> I always understood than when activated through a web browser that
> $_SERVER['SERVER_NAME'] and $_SERVER['HTTP_HOST'] identified the domain name under
> which the script was being run, but I have come across some instances where both
> SERVER_NAME and HTTP_HOST appear to be spoofed, and I wondered if this is legitimate
> or not.
> 
> I have an application which exists on a live server and a test server, with a
> different database for each, and they both share a common config file which
> identifies which server it is running on so that it can use the relevant database
> credentials. If the server name does not match either of the live or test domain
> names (such as mydomain.com and test.mydomain.com) then it uses invalid credentials
> which causes an error when attempting to access the database. I never though that
> this error would ever appear, but lately I have been getting errors such as the
> following:
> 
> Fatal Error: mysqli_connect(): Access denied for user 'default'@'localhost' (using
> password: YES).
> Error in line 259 of file
> '/var/www/vhosts/mydomain.com/httpdocs/transix/includes/dml.mysqli.class.inc'.
> PHP_SELF: /index.php
> CURRENT DIRECTORY: /var/www/vhosts/mydomain.com/httpdocs
> SERVER_ADDR: nnn.nnn.nnn.nnn
> SERVER_NAME: www.yahoo.com
> HTTP_HOST: www.yahoo.com
> REMOTE_ADDR: 109.108.142.236
> REQUEST_URI: http://www.yahoo.com/
> 
> In order to run this script on my live server the URL should have been
> www.mydomain.com but here you can see it reported as www.yahoo.com. How is this
> possible?

I can think of several ways:

The client did not use HTTP/1.1 = client request without a hostname

Something like apache mod_rewrite on the server is doing it

any other misconfiguration on the server sites (hopefully temporary)

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-11 10:53 +0000
  Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Scott Johnson <noonehome@chalupasworld.com> - 2012-12-11 05:28 -0800
    Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Paul Herber <paul@pherber.com> - 2012-12-11 14:01 +0000
      Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-12 13:05 +0000
    Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-12 07:25 +0000
      Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Scott Johnson <noonehome@chalupasworld.com> - 2012-12-12 05:27 -0800
        Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-12 17:22 +0000
          Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-12 10:50 -0800
            Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? The Natural Philosopher <tnp@invalid.invalid> - 2012-12-12 19:34 +0000
              Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-13 06:52 +0000
                Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Anders Wegge Keller <wegge@wegge.dk> - 2012-12-13 08:02 +0100
                Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? The Natural Philosopher <tnp@invalid.invalid> - 2012-12-13 11:43 +0000
  Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-11 17:26 +0100
    Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-12 13:10 +0000
  Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? Christoph Becker <cmbecker69@gmx.de> - 2012-12-12 13:11 +0100
    Re: When is it possible for $_SERVER['SERVER_NAME'] to contain something other than the URL which actvated the script? "Tony Marston" <TonyMarston@hotmail.com> - 2012-12-12 13:00 +0000

csiph-web