Toon posts:

[php] host functie geeft steeds localhost :(

Pagina: 1
Acties:

Verwijderd

Topicstarter
PHP:
1
<?function getHost() {    global $HTTP_X_FORWARDED_FOR;        if (gethostbyaddr(getenv(HTTP_X_FORWARDED_FOR)) <> "") {         return gethostbyaddr(getenv(HTTP_X_FORWARDED_FOR));    }else{         return "Unknown";    }}?>

why?...

Ik niet begrijp :( ik krijg steeds CC34xxx-x :( en dat vind ik niet crewl... weet iemand hier een oplossing voor?

  • Grum
  • Registratie: Juni 2001
  • Niet online
first of all

'<>' is geen php operator die veel word gebruikt - gebruik gewoon '!=' om verwarring te voorkomen

ten 2e global je $HTTP_X_FORWARDED_FOR en vervolgens haal je em op met getenv (je hoeft en moet em dus niet globallen)

en ten 3e hoop ik dat je weet dat gethostbyname zonder problemen 30 tot 60 gaat hangen wachtende op een antwoord wat ie niet zal krijgen als ie een ip niet kan resolven.

nu je probleem:

wat staat er in $HTTP_X_FORWARDED_FOR ?

Verwijderd

Doe eens
PHP:
1
<?getenv("HTTP_X_FORWARDED_FOR")?>

ipv
PHP:
1
<?getenv(HTTP_X_FORWARDED_FOR)?>

.

  • Grum
  • Registratie: Juni 2001
  • Niet online
:( ZUCHT :(

Warning: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in - on line X

Ga aub met error_reporting(E_ALL); coden en controleer je antwoord voor je uberhaubt iets intikt. Tnx

Verwijderd

Topicstarter
Op dinsdag 05 maart 2002 11:04 schreef Grum het volgende:
:( ZUCHT :(

Warning: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in - on line X

Ga aub met error_reporting(E_ALL); coden en controleer je antwoord voor je uberhaubt iets intikt. Tnx
Leuk leuk :)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Warning: Use of undefined constant server - assumed 'server' in e:\php\stat\db.include.php on line 9

Warning: Use of undefined constant user - assumed 'user' in e:\php\stat\db.include.php on line 10

Warning: Use of undefined constant pass - assumed 'pass' in e:\php\stat\db.include.php on line 11

Warning: Use of undefined constant db - assumed 'db' in e:\php\stat\db.include.php on line 12

Warning: Use of undefined constant id - assumed 'id' in e:\php\stat\db.include.php on line 13

Warning: Use of undefined constant server - assumed 'server' in e:\php\stat\db.include.php on line 4

Warning: Use of undefined constant user - assumed 'user' in e:\php\stat\db.include.php on line 4

Warning: Use of undefined constant pass - assumed 'pass' in e:\php\stat\db.include.php on line 4

Warning: Use of undefined constant db - assumed 'db' in e:\php\stat\db.include.php on line 5

Warning: Use of undefined constant active - assumed 'active' in e:\php\stat\xstat.php on line 570

Warning: Use of undefined constant id - assumed 'id' in e:\php\stat\xstat.php on line 575

Warning: Use of undefined constant id - assumed 'id' in e:\php\stat\xstat.php on line 575

Warning: Use of undefined constant ip - assumed 'ip' in e:\php\stat\xstat.php on line 576

Warning: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in e:\php\stat\xstat.php on line 109

Warning: Use of undefined constant REMOTE_ADDR - assumed 'REMOTE_ADDR' in e:\php\stat\xstat.php on line 112

Warning: Use of undefined constant host - assumed 'host' in e:\php\stat\xstat.php on line 577

Warning: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in e:\php\stat\xstat.php on line 124

Warning: Use of undefined constant HTTP_X_FORWARDED_FOR - assumed 'HTTP_X_FORWARDED_FOR' in e:\php\stat\xstat.php on line 125

Warning: Use of undefined constant referer - assumed 'referer' in e:\php\stat\xstat.php on line 578

Warning: Use of undefined constant country - assumed 'country' in e:\php\stat\xstat.php on line 579

Warning: Use of undefined constant browser - assumed 'browser' in e:\php\stat\xstat.php on line 580

Warning: Use of undefined constant os - assumed 'os' in e:\php\stat\xstat.php on line 581

Warning: Undefined variable: os in e:\php\stat\xstat.php on line 147

Warning: Use of undefined constant date - assumed 'date' in e:\php\stat\xstat.php on line 582

Warning: Use of undefined constant hour - assumed 'hour' in e:\php\stat\xstat.php on line 583

Warning: Use of undefined constant day - assumed 'day' in e:\php\stat\xstat.php on line 584

Warning: Use of undefined constant host - assumed 'host' in e:\php\stat\xstat.php on line 587

Warning: Use of undefined constant referer - assumed 'referer' in e:\php\stat\xstat.php on line 588

Warning: Use of undefined constant referer - assumed 'referer' in e:\php\stat\xstat.php on line 589

Warning: Use of undefined constant country - assumed 'country' in e:\php\stat\xstat.php on line 591

Warning: Use of undefined constant browser - assumed 'browser' in e:\php\stat\xstat.php on line 592

Warning: Use of undefined constant os - assumed 'os' in e:\php\stat\xstat.php on line 593

Warning: Use of undefined constant hour - assumed 'hour' in e:\php\stat\xstat.php on line 594

Warning: Use of undefined constant day - assumed 'day' in e:\php\stat\xstat.php on line 595

Warning: Use of undefined constant title - assumed 'title' in e:\php\stat\xstat.php on line 604

Warning: Cannot add header information - headers already sent by (output started at e:\php\stat\db.include.php:9) in e:\php\stat\xstat.php on line 525

Warning: Cannot add header information - headers already sent by (output started at e:\php\stat\db.include.php:9) in e:\php\stat\xstat.php on line 526

Warning: Cannot add header information - headers already sent by (output started at e:\php\stat\db.include.php:9) in e:\php\stat\xstat.php on line 527

Warning: Cannot add header information - headers already sent by (output started at e:\php\stat\db.include.php:9) in e:\php\stat\xstat.php on line 528

:( gaat lekker zo ;)

Verwijderd

Topicstarter
Mja ga er vanmiddag wel verder op spacen heb nu andere dingen te doen... tnx ppl... komt wel goed, ooit :+

  • Grum
  • Registratie: Juni 2001
  • Niet online
ach .. zoals me sig al zegt he ...

:z
Pagina: 1