SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Script for homepage (hopefully)

    Hi everyone!

    Sitepoint has never let me down in the past, so I thought I would give it another go for the new script I need

    Here is an idea of what i want to do, maybe someone could tell me the best way to achieve this?

    My main site:
    mysite.com

    Other domain names I own:
    domain1.com domain2.com someother.com somethingelse.com

    In apache, I have all of the above domains set to point to "mysite.com" using the "server alias" directive. All of the domains are for sale and I would like to give the user a little info instead of just directing them to mysite.com when they type domain1.com into their browser.

    Here is what I had in mind.

    1) User Visits Domain1.com

    2) User is directed to mysite.com

    3) User is displayed a link at the top of the page on mysite.com saying "Why was I brought here when trying to access domain1.com"

    4) User clicks link, and it takes them to a page explaining that domain1.com is for sale

    I was hoping to pass the domain name to this page in a variable so that I dont need a different page for each domain name I am selling.

    Any ideas on the best way to achieve this?

    Thanks in advance

  2. #2
    SitePoint Zealot ant1832's Avatar
    Join Date
    Apr 2002
    Location
    Tucson, AZ
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here you go. Found it in 30 sec by using search...you should try it

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That thread didn't help me at all. Thanks for trying though.

  4. #4
    SitePoint Zealot ant1832's Avatar
    Join Date
    Apr 2002
    Location
    Tucson, AZ
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Simple Script for homepage (hopefully)

    What do u mean it didn't help...you said
    Originally posted by TechTalk
    I was hoping to pass the domain name to this page in a variable so that I dont need a different page for each domain name I am selling.
    And that is exactly what $_SERVER['HTTP_HOST'] does(taken from the link I gave you.)

    Maybe this is not what you were meaning to ask for...can you give us more info on what else you need.

  5. #5
    And your point is.... redgoals's Avatar
    Join Date
    Feb 2002
    Location
    Birmingham, UK
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this on "mysite.com"..

    PHP Code:
    <?
    if(preg_match("/domain1.com/",$HTTP_REFERER)){
    echo 
    "Why was I brought here when trying to access domain1.com";
    }
    elseif(
    preg_match("/domain2.com/",$HTTP_REFERER)){
    echo 
    "Why was I brought here when trying to access domain2.com";
    }
    elseif(
    preg_match("/domain3.com/",$HTTP_REFERER)){
    echo 
    "Why was I brought here when trying to access domain3.com";
    }
    ?>
    will obviously only work when referred from domain1/2/3.com via a meta refresh tag or a hyperlink.
    Last edited by redgoals; May 28, 2002 at 15:49.
    http://redgoals.com ... my site ... nuff said

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically all of these other domains are setup in the virtual config for mysite.com in apache. There I am using "ServerAlias" to direct all the other domains to the domain mysite.com

    If possible, I would like to put all the domain names in some sort of array if possible, and run a check thru the array when the user is brought to the page.

    I dont even really need to post any text on mysite.com like i originally stated. If it could just redirect the user to a page on mysite.com explaining that the domain they accessed is for sale that would be great.

    I have little to no knowledge of php, but I thru a basic concept together of what I am trying to do. Any advice would be much appreciated.

    Code:
    <?
    $domains=array(
    			"domain1.com",
    			"somedomain.com",
    			"domain111.com",
    			"anotherdomain.com",
    			"yetanother.com",
    			"anorg.org",
    			"anothercom.com",
    			"gogogo.com",
    			"yoyooy.com",
    			"johndoe.net",
    			"joe.com",
    				
    			);
    
    if (preg_match($domains, $HTTP_REFERER) {
    	header("Location:http://www.mysite.com/domains/index.php?domain=$HTTP_REFERER");
        
    }
    
    
    ?>
    Then my thoughts were, maybe I could use an include in my main page to call the file above, and the /domains/index.php file could just look something like this:

    Code:
    <html>
    <head>
    <title></title>
    </head>
    <body>
    The domain, <? echo $domain ?> is for sale!
    </body>
    </html>
    I know my logic here is flawed, so any help would really be appreciated lol.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just checked, and $HTTP_REFERER has no value if the user is directed the way that I am directing them (using apache's ServerAlias directive)

  8. #8
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try using $REQUEST_URI instead of $HTTP_REFERER. with register_globals off i think its $_SERVER['REQUEST_URI'].
    Last edited by Trav; Jun 10, 2002 at 14:12.
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •