Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7757 > unrolled thread
| Started by | C <wrong.address.1@gmail.com> |
|---|---|
| First post | 2012-12-10 11:05 -0800 |
| Last post | 2012-12-11 00:41 +0100 |
| Articles | 5 — 5 participants |
Back to article view | Back to comp.lang.php
Old version trouble with $_SERVER variables? C <wrong.address.1@gmail.com> - 2012-12-10 11:05 -0800
Re: Old version trouble with $_SERVER variables? Salvatore <sal@yojimbo.hack.invalid> - 2012-12-10 20:37 +0000
Re: Old version trouble with $_SERVER variables? The Natural Philosopher <tnp@invalid.invalid> - 2012-12-10 21:03 +0000
Re: Old version trouble with $_SERVER variables? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-10 21:55 +0100
Re: Old version trouble with $_SERVER variables? Gregor Kofler <usenet@gregorkofler.com> - 2012-12-11 00:41 +0100
| From | C <wrong.address.1@gmail.com> |
|---|---|
| Date | 2012-12-10 11:05 -0800 |
| Subject | Old version trouble with $_SERVER variables? |
| Message-ID | <611eeace-68f0-48b1-9503-d1911378a427@a15g2000vbf.googlegroups.com> |
What is causing the $host, $realhost and $referer variables to be
blank?
<?php
global $host;
$date = date("F jS Y, h:iA");
$host=@gethostbyaddr($_SERVER['REMOTE_ADDR']);
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != "")
{$realhost =
@gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);}
$referer = $_SERVER['$HTTP_REFERER'];
mail("my.address@whatever", "visitor information", "$host at $date
from
$referer.
Forwarded for $realhost");
?>
[toc] | [next] | [standalone]
| From | Salvatore <sal@yojimbo.hack.invalid> |
|---|---|
| Date | 2012-12-10 20:37 +0000 |
| Message-ID | <ka5h6q$1ld7$1@yojimbo.hack> |
| In reply to | #7757 |
On 2012-12-10, C <wrong.address.1@gmail.com> wrote: > What is causing the $host, $realhost and $referer variables to be > blank? It's possible that the gethostbyaddr() function is failing and no referrer is sent. -- Blah blah bleh... GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-12-10 21:03 +0000 |
| Message-ID | <ka5imk$8je$1@news.albasani.net> |
| In reply to | #7758 |
On 10/12/12 20:37, Salvatore wrote: > On 2012-12-10, C <wrong.address.1@gmail.com> wrote: >> What is causing the $host, $realhost and $referer variables to be >> blank? > > It's possible that the gethostbyaddr() function is failing and no referrer > is sent. > If it is happening across all browsers its more likely that the web server is failing to invoke PHP with the correct arguments set so that COULD be a server configuration problem. I don't know how the linkage is achieved though, so that's the limit of my Thought. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Date | 2012-12-10 21:55 +0100 |
| Message-ID | <ain0iqFel0gU1@mid.uni-berlin.de> |
| In reply to | #7757 |
Am 10.12.2012 20:05, schrieb C:
> What is causing the $host, $realhost and $referer variables to be
> blank?
>
> <?php
>
> global $host;
>
> $date = date("F jS Y, h:iA");
>
> $host=@gethostbyaddr($_SERVER['REMOTE_ADDR']);
You should not suppress error messages when you are trying to find an error.
/Str.
[toc] | [prev] | [next] | [standalone]
| From | Gregor Kofler <usenet@gregorkofler.com> |
|---|---|
| Date | 2012-12-11 00:41 +0100 |
| Message-ID | <ka5rv1$hdd$1@dont-email.me> |
| In reply to | #7757 |
Am 2012-12-10 20:05, C meinte:
> What is causing the $host, $realhost and $referer variables to be
> blank?
>
> <?php
>
> global $host;
>
> $date = date("F jS Y, h:iA");
>
> $host=@gethostbyaddr($_SERVER['REMOTE_ADDR']);
>
> if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != "")
> {$realhost =
> @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);}
$HTTP_SERVER_VARS has been deprecated since ages.
> $referer = $_SERVER['$HTTP_REFERER'];
Shouldn't that be $_SERVER['HTTP_REFERER']?
If gethostbyaddr() was coded with the same rigor, it's highly plausible
that the other variables are "empty", too. Which they aren't. Turn on
your error reporting and fix your bugs.
Gregor
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web