Well you have to decide how you are going to determine if they are from the appropriate place. You have a couple of choices:
- Check the REMOTE_ADDR environment variable (set by standard CGI and mod_perl, there are other ways to get it for different web apps), do a reverse look up on it and check the domain
- Have some token they use to ID which discount applies then either keep it as a hidden on all pages, store it on the server side session info for the user or set a cookie
Choice 1, relying on the DNS name:
use Socket;
my $remote_addr = $ENV{REMOTE_ADDR};
my $remote_host =
gethostbyaddr(itet_aton($remote_addr), AF_INET);
if ($remote_host =~ /\.oracle\.com$/) {
# Do whatever
}
Implementing choice 2 is up to you since it is very dependent on the code you are using.
The advantage of the first is that there is not much you have to do to get it to work since the hostname should not change over the course of the transaction. With the second you have to store the token somewhere so that you can access it on each request. Depending on the infrastructure you have in place, that may be easy.
Where the second choice wins is that it is possible that not all IP addresses have a reverse lookup even if they are all in Oracle's domain. Also people may be accessing Oracle mail through a VPN so the discount would not apply to them. If you have a special token then this does not matter since the token applies no matter where they come from. Also you can use the same mechanism for promotional purposes where you issue a discount 'coupon' if they do something. The obvious downside is that people can mail the tokens around so other people may get the discount.
-ben |