Terra Posted September 27, 2013 Share Posted September 27, 2013 I'm using http://www.mydomain.com and whmcs.mydomain.com. In the old * I could change the cookie code to cover all sub-domains like so: setcookie("WHMCSAffiliateID", $aff, time()+60*60*24*60,'/','.mydomain.com'); Can anyone advise what the code would look like with the new code? default is WHMCS_Cookie::set('AffiliateID',$aff,'3m'); Does anyone know how I can add the domain information into this so it covers all my sub-domains? Many thanks, Edith 0 Quote Link to comment Share on other sites More sharing options...
WHMCS TedX Posted September 28, 2013 Share Posted September 28, 2013 Hi Edith! It seems that the functionality you want (the ability to set the domain filter of a cookie) is currently not available. So, first, I would ask that you please go ahead and submit a Feature Request for this functionality, giving your above scenario as a usage case. Once you do so, post the link to your request on this thread. --------- What you want to do *is* feasible to do on your own, however, I would suggest it is probably inadvisable, due to unknown potential ramifications of an arbitrary, untested change to an internal cookie. However, if you're willing to live with any and all potential negative side-affects, here is how I would do this, if I were in your shoes. But please, Edith, thoroughly test the app after your changes. /* THIS CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // 1. Set the cookie as normal: WHMCS_Cookie::set('AffiliateID', $aff, '3m'); // This will ensure that any and all behind-the-scenes things that should be done get done. // 2. Kill the cookie. // 2a. Remove PHP's knowledge of the cookie. unset($_COOKIE["WHMCSAffiliateID"]); // 2b. Set the browser's cookie to timeout and die immediately. setcookie("WHMCSAffiliateID", "", time() - 3600); // 3. Create a new cookie with your desired domain filter. // 3a. Calculate the expiration time, in seconds. Default for this particular cookie is 3 months. $expires = time() + (3 * 30 * 24 * 3600); // 3b. Create it. setcookie("WHMCSAffiliateID", $aff, $expires, "/", ".yourdomain.com", false, true); 0 Quote Link to comment Share on other sites More sharing options...
Terra Posted September 30, 2013 Author Share Posted September 30, 2013 Hi Edith! It seems that the functionality you want (the ability to set the domain filter of a cookie) is currently not available. So, first, I would ask that you please go ahead and submit a Feature Request for this functionality, giving your above scenario as a usage case. Once you do so, post the link to your request on this thread. Hi Ted, Thank you for taking the time for your detailed reply! As suggested, I have submitted this as feature request: https://requests.whmcs.com/responses/ability-to-set-domain-filter-on-whmcs-cookie Many thanks, Edith 0 Quote Link to comment Share on other sites More sharing options...
HostStratus Posted November 23, 2013 Share Posted November 23, 2013 Hate to grave dig after 2 months, but this feature is REALLY needed. I can't see any other feasible way to transfer a sessionUID across multiple domains. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.