**Do you love cookies? This is for you!** I need a very simple process which saves a part of an URL into a cookie, and then later uses a table to make a decision based on that cookie. This won't take you long at all, and is an ideal project for a RentACoder newbie.
This project involves three files, which are hosted on multiple websites, under multiple domains. The first file determines certain characteristics about the fully qualified domain name (FQDN) under which it is hosted, and saves certain information to a cookie (which of course can only be read by other scripts in that domain). The third file will take that cookie, along with a lookup table, and redirect the user to yet a different location, based on that information.
In all code, use standard, existing PHP functions; do
*not* reinvent the wheel here! Each paragraph below typically translates into one line of code; if you find to the contrary, ask for help before implementing anything!
**[url removed, login to view]** will determine the current FQDN under which it is hosted, e.g., "[url removed, login to view]".
Parse the secondary domain name. Using a case *in*sensitive comparison, compare it to a series of names in an array. If it matches one, save the name from the array into a $SecondaryDomain variable (not a cookie); if it doesn't, simply set $SecondaryDomain to whatever was parsed. The entire point of this lookup is to ensure that future processes use the correct capitalization from a *marketing* perspective (even though *DNS* does not care). Thus, if the FQDN is "[url removed, login to view]" and the array includes "DomainOne" and "DomainTwo", then $SecondaryDomain will get set to "DomainOne".
Parse the tertiary domain name. (Toss any additional tokens which may or may not precede it, such as "www.".) If one does not exist, use a default of "www". Set a $TertiaryDomain variable, and then a TertiaryDomain cookie. (You will need to use $SecondaryDomain to do this.) The cookies should be of the wildcard ("*") variety, so that any tertiary domain can read any other tertiary domain's cookie.
**[url removed, login to view]** is a framed page which will simply include [url removed, login to view] in a single frame, for the sole purpose of hiding the following redirection from the casual observer. (Yes, it's still possible to look at page source and see what is happening; the intent is not to hide this from all eyes.)
**[url removed, login to view]** will probably need to determine the $SecondaryDomain, just for the cookie fetch. (This function may be stored in a [url removed, login to view] file if you'd like, rather than repeating the code.) Fetch the $TertiaryDomain from the cookie. If it is empty, null, or otherwise unavailable, use a default of "www".
Take the $TertiaryDomain and compare it to a lookup table which contains a series of ($campaign, $affiliate) pairs. If $TertiaryDomain matches a $campaign, (case insensitive), then set $ThisAffiliate to the corresponding $affiliate, otherwise set it to a $DefaultAffiliate ("me"). This is the point of this entire exercise: Most of the campaigns are mine, but a few of them are being done for other affiliates as a favor.
Redirect the visitor to yet another page which uses $ThisAffiliate and $TertiaryDomain as variables in its URL.
* * *I'm pretty flexible and easy to work with. I tried to make sure that this job is as completely specified as humanly possible.
If you have **any** questions, *please* ask them! I have found that it is far better to risk a bit of embarrassment than to spend time working on an assumption which later proves to be wrong. Do not worry that a question may seem silly; just *let me know* and I will be very happy to answer you!
We've been a Buyer here since July '05, with a rating of 9.9 ("Excellent") out of 10, with over 75 ratings, and we've now paid on over 95 jobs. We've completed both security verifications, we have a non-action ratio under 5% ("very good"), and we've lost 0 out of 10 mediations / arbitrations.
| ! | PGP is **not** required for this project. |
| ! | An NDA is **not** required for this project. |
We will retain full legal rights to the code and/or data upon completion. All code and/or data is and becomes *our* intellectual property! You will *not* have any rights to the code and/or data in any fashion.
**Thank you for your consideration and for bidding through RentACoder!**
* * *Copyright ? 2007, RentACoder Buyer
[notecom]. **All Rights Reserved.** Reproduction without permission is strictly prohibited.
* * *
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
PHP (under Linux, but this shouldn't matter)