How to call different pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cornishcat
Forum Newbie
Posts: 2
Joined: Thu Feb 19, 2009 3:32 am

How to call different pages

Post by cornishcat »

Hi,
I have created two distinctly different stats tools, I now need to have some sort of mechanism to make sure the right stats page is called.

I have the following so far

Code: Select all

 
$pageurl = //Some value from Referer
    
    $page = explode("/", $pageurl);
    $oururl = $page[2];
    
    $siteone = "www.url1.co.uk";
    $sitetwo = "www.url2.com";
    $sitethr = "www.url3.co.uk";
 
    $siteslist = array($siteone, $sitetwo, $sitethr);
 
    if (in_array($oururl,$siteslist, TRUE)){
    $recordhits = "True";
        //Do something relating to these urls
    } else {
    // not found in string
    // Do the other scripts
    $recordhits = "False";
    }
 
However since I'm an ASP programmer, I would have done a response.redirect in the If Else script, but that isn't the same in PHP, so my question is:-
Should I do the array and coding above in an include and just wrap the If else differently in each file, because I want to keep each stats file separate or is there another way to achieve the same goal?

Any suggestions would be welcome.
Steve
Post Reply