Jump to content

true3000

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by true3000

  1. Alright, so here's the deal...and yes, I have searched high and low and haven't been able to find the solution I am looking for.

     

    I want to create a subdomain such as texas.mydomain.com and when someone visits that site they get redirected to my main domain BUT with a welcome message such as "Hi Texans, welcome to mydomain.com"...

     

    Now when someone enters just mydomain.com it would read as something generic like..."Hi there"...

     

    Anybody know what the appropriate code would be or at least point me in the right direction?

     

    EDIT:

     

    I was able to come up with the following but it causes the site to return blank...

    <?
    $states = array(
              "tx" => "Texan",
              "ak" => "Alaskan"
              );
    
    // If the "s" (state) parameter isn't set or the state code doesn't exist in the array (user tampered), show generic message
    if ((!isset($_GET['s'])) || (!array_key_exists($_GET['s'], $states))) {
         echo "Insert generic welcome message."
    } else {
         $key = $_GET['s'];
         echo "Welcome, " . $states[$key] . "." // Shows "Welcome, Texan." etc.
    }
    ?>

     

    the subdomain is redirected using:

    <?
    // Redirects user to main site, with parameter "s" (state) as "tx" (Texas)
    header("Location: http://www.mydomain.com/?s=tx");
    ?>

     

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.