Well you have to decide how you are going to determine if they are from the appropriate place. You have a couple of choices:

  1. 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
  2. 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


In reply to Re: Changing website prices based on client? (keywd: Web Software Engr) by knobunc
in thread Changing website prices based on client? (keywd: Web Software Engr) by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.