note 32740 modified in function.header by stone

From: Date: Sat, 28 Jun 2003 21:41:23 +0000
Subject: note 32740 modified in function.header by stone
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51144@lists.php.net to get a copy of this message
[Editor's note: You should not place files that you don't want to be called directly below the root directory of your web pages. Instead, you put them into a separate includes directory which not accessible by a public URL.] I have an index page that include_once()'s different PHP files (the different page's contents) based on the ?page= query string. To keep people from linking directly to http://www.mysite.com/sitenews.php I put: header("Location: http://www.mysite.com/?page=sitenews"); in the first line of sitenews.php. Now if it is included from index.php (as it should be) then this header call will fail and no redirect will take place. However, if you call the file directly, it will toss you into my index.php page with the correct ?page= query string. --was-- I have an index page that include_once()'s different PHP files (the different page's contents) based on the ?page= query string. To keep people from linking directly to http://www.mysite.com/sitenews.php I put: header("Location: http://www.mysite.com/?page=sitenews"); in the first line of sitenews.php. Now if it is included from index.php (as it should be) then this header call will fail and no redirect will take place. However, if you call the file directly, it will toss you into my index.php page with the correct ?page= query string. http://www.php.net/manual/en/function.header.php

« previous php.notes (#51144) next »