criat Posted March 18, 2014 Share Posted March 18, 2014 Hello, I'm setting a SESSION in my HTML page that doesn't gets pulled by WHMCS: HTML header.php <script> $(document).ready(function() { $(".comprarnaologado").click(function(){ var pid = $(this).data('pid'); $.post("/redirecttoproduct.php", {"pidofproduct": pid}); }); }); </script> redirecttoproduct.php <?php if(!session_id()) session_start(); $_SESSION['redirectproductpid'] = $_POST['pidofproduct']; ?> It echoes: print_r($_SESSION); = Array ( [tkval] => 48jEK8Xm7f5m [redirectproductpid] => 14 ) But on WHMCS, the $_SESSION doesn't contain redirectproductpid print_r($_SESSION); Array ( [tkval] => c7Brzy1qww6o [calinkupdatecc] => 0 [calinkupdatesq] => 0 [cart] => Array ( [user] => Array ( [country] => BR ) ) [Language] => brasil [uid] => 27 [upw] => 60dafaa05bca2fdc335640beb8202199fde50f30 ) I think it's starting a new SESSION, how can I make WHMCS pages and non-WHMCS pages share the same SESSION? Thanks! 0 Quote Link to comment Share on other sites More sharing options...
KousakaKirino Posted March 22, 2014 Share Posted March 22, 2014 Hey, WHMCS uses a different cookie name then the default PHP session. You can use this code to find the cookie name and start the session. You may need to tweak depending on your environment. foreach ($_COOKIE as $cookie => $value) { if (stripos($cookie, 'WHMCS') === 0 and strlen($cookie) >= 13) { session_name($cookie); if(!session_id()) { session_start(); } } } 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.