• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

redir code

Hello there,
I whould like to edit this code, is working fine but Im looking for something shorter..

if (isset($_SERVER['QUERY_STRING']) ) {
     switch( $_SERVER['QUERY_STRING']) {
          case "YdcN6eDAj6xB":
                       header ("Location: http://www.aol.com");
                       exit;

          case "hXzRz35YszHA":
                       header ("Location: http://www.yahoo.com");
                       exit;

     }
}



I would like something like this


if (isset($_SERVER['QUERY_STRING']) ) {
     switch( $_SERVER['QUERY_STRING']) {
          case "YdcN6eDAj6xB" or "hXzRz35YszHA" or "zpgcAQoNMu8S":
                       header ("Location: http://www.aol.com");
                       exit;
     }
}


is it possible?
0
XK8ER
Asked:
XK8ER
1 Solution
 
wjesterCommented:
you could do this:

if (isset($_SERVER['QUERY_STRING']) ) {
     switch( $_SERVER['QUERY_STRING']) {
          case "YdcN6eDAj6xB": case "hXzRz35YszHA": case "zpgcAQoNMu8S":
                       header ("Location: http://www.aol.com");
                       exit;
     }
}
0
 
hernst42Commented:
See http://www.php.net/manual/en/control-structures.switch.php
if (isset($_SERVER['QUERY_STRING']) ) {
     switch( $_SERVER['QUERY_STRING']) {
          case "YdcN6eDAj6xB":
          case "hXzRz35YszHA":
          case "zpgcAQoNMu8S":
                       header ("Location: http://www.aol.com");
                       exit;
     }
}

Open in new window

0
 
Beverley PortlockCommented:
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now