| Posted by J.O. Aho on 12/17/06 22:35 
David Bagge wrote:> How do I create a redirect.php page that i can use for many url's?
 >
 > Ex: http://www.mydomain.com/redirect.php?redirID=1 and
 > http://www.mydomain.com/redirect.php?redirID=2
 >
 > My real question is how do I define a page's contents by a database.
 >
 
 --- redirect.php ---
 <?PHP
 /* This is a hardcoded version, a database based  don't need a switch */
 switch ($_REQUEST['redirID']) {
 case 1:
 /* redirID=1 */
 header('Location: http://www.example.net');
 break;
 case 2:
 /* redirID=2 */
 header('Location: http://www.example.com');
 break;
 default:
 /* When redirID don't match */
 header('Location: http://www.microsuck.com');
 break;
 }
 --- eof ---
 
 --
 
 //Aho
  Navigation: [Reply to this message] |