[php] variable in header() functie

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
PHP:
1
header("location:filename.php?s=1");


of

PHP:
1
header("location:".$PHP_SELF."?s=1");


Ik wil de onderste variant gebruiken. Op de server gaat dat prima, maar lokaal wordt de header functie niet uitgevoerd zodra ik een variabele (in het voorbeeld: $PHP_SELF) gebruik.

Welke setting moet ik hiervoor wijzigen? of is er een nettere manier om variabelen te gebruiken in de header functie?

[ Voor 11% gewijzigd door Verwijderd op 02-07-2003 16:13 ]


Acties:
  • 0 Henk 'm!

  • RM-rf
  • Registratie: September 2000
  • Laatst online: 17-09 17:10

RM-rf

1 2 3 4 5 7 6 8 9

misschien werkt $_SERVER['PHP_SELF'] wel?
http://de3.php.net/manual...reserved.variables.server

aan het gebruik van de header-functie ligt het niet, eerder aan en verkeerde waarde van de variabele $_PHP_SELF, wat kan komen doordat register_globals uitstaat
http://de3.php.net/manual....php#ini.register-globals

[ Voor 60% gewijzigd door RM-rf op 02-07-2003 16:23 ]

Intelligente mensen zoeken in tijden van crisis naar oplossingen, Idioten zoeken dan schuldigen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
het gebruik van $_PHP_SELF ipv $PHP_SELF blijkt wel te werken

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
echter bij gebruik van $_REQUEST_URI wordt je geredirect naar
Found

The document has moved here.
Apache/2.0.43 Server at localhost Port 80
bij klikken op "here" kom ik wel terecht waar ik wil komen

hoe dat op te lossen?

Acties:
  • 0 Henk 'm!

  • RM-rf
  • Registratie: September 2000
  • Laatst online: 17-09 17:10

RM-rf

1 2 3 4 5 7 6 8 9

code:
1
header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);

[ Voor 22% gewijzigd door RM-rf op 02-07-2003 16:43 ]

Intelligente mensen zoeken in tijden van crisis naar oplossingen, Idioten zoeken dan schuldigen


Acties:
  • 0 Henk 'm!

Verwijderd

Nou weet ik niet of de vorige reply je al geholpen heeft of niet maar misschien heb je wat aan het volgende:
The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless some 3xx status code has already been set.
10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

[ Voor 4% gewijzigd door Verwijderd op 02-07-2003 17:04 ]

Pagina: 1