Ok, let me first say, as I did in another thread, that you may have not read, I am a Perl programmer, learning PHP.
I have a client that wants this site done in PHP because some of his servers do not even have Perl, and if he had to put this on one of those servers, it might now work. With that said, here is what I'm trying to do...
Ok. I am making an affiliate program, where their MIGHT be two ways to get to the site:
domain name:
http://www.mydomain.com/
OR
http://www.sharedomain.com/aff_id/
The first is if they are a big affiliate, they will get their own id, I can get their id, by getting just the domain name:
$url = $HTTP_HOST;(domain name only...
list($mailer,$ext1) = split (".", $url, 2);
How would I go about checking to make sure the site is NOT the sharedomain.com, and if it is NOT, then I need to get this:
/aff_id/
without the / on each end.
I know how to do it in Perl, but how does PHP do it?
Perl code:
if($url =~ /sharedomain.com/i) {
ok its the shared domain, get the id:
$url =~ s/(http:\/\/|www.|sharedomain.com\/)//; # Get rid of the first part (http://www.)
$url = substr $url, 0, -1;# Get rid of the LAST /
}
Ok, $url would now contain the affiliates id.
That is just a sloppy way of doing it in Perl. I don't know HOW to do it in PHP. I'd appreciate any tips.