sherwin_flight Posted October 7, 2014 Share Posted October 7, 2014 I'm working on a fairly complex WHMCS integration on my website. I have created a custom template, and so far it's working great. I have run in to one small glitch though, that I would like to figure out. On my non-WHMCS pages I am setting a php session variable. I confirmed that this session variable is being created properly, and I can access it from different sub-domains, which is what I want. Now, in my header.tpl file for WHMCS I need a way to be able to get the value of this variable. The variable is not being set by WHMCS, but by my other pages, but should be accessible to my WHMCS sub-directory. So how can I call a variable set on http://www.example.com from whmcs.example.com in my header.tpl file? 0 Quote Link to comment Share on other sites More sharing options...
sherwin_flight Posted October 7, 2014 Author Share Posted October 7, 2014 (edited) I have seen lots of examples of how to get WHMCS info on non-WHMCS pages, but I'm trying to do the opposite. I'm trying to get a session variable from a non-WHMCS page on a WHMCS page. I should also note that I am trying to do this without having to pass any variables through the URL using GET. Edited October 7, 2014 by sherwin_flight Adding info 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 7, 2014 Share Posted October 7, 2014 You could put your own PHP inside {php}{/php} tag in header.tpl file. In this way all variables will be shared among all template pages. A better solution would be to directly include your PHP with Smarty still in header.tpl. {include_php file='yourscript.php'} 0 Quote Link to comment Share on other sites More sharing options...
sherwin_flight Posted October 7, 2014 Author Share Posted October 7, 2014 I have no problem including PHP in my template files, that's not the problem. The problem is that even when I put php in my template files the sessions I set on the other pages doesn't show up. 0 Quote Link to comment Share on other sites More sharing options...
sherwin_flight Posted October 7, 2014 Author Share Posted October 7, 2014 (edited) Like, I set the session on http://www.example.com, and I can use the session variable on any pages from http://www.example.com, but when I browse to whmcs.example.com and do a print_r($_SESSION) it shows the WHMCS session variables, but not the ones I set on the WWW pages. I have figured out what the session_name is for my WHMCS install, and set session_name on the WWW pages to the same thing so that the sessions set there are available within WHMCS. At least that was my understanding from some of the posts I have read online. WWW is served over HTTP, and WHMCS is served over HTTPS, but I have the secure option set to true when the sessions are created on the WWW pages, so they should be available to HTTPS. Edited October 7, 2014 by sherwin_flight Added info 0 Quote Link to comment Share on other sites More sharing options...
sherwin_flight Posted October 7, 2014 Author Share Posted October 7, 2014 I scrapped the idea of sessions because it was getting to be too much of a headache for something simple, and used cookies instead since it was not sensitive information that was being stored, just a simple preference. Have what I was trying to do almost done in a fraction of the time it took me to search for a solution using sessions. 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.