Jump to content

WHMCS Integration & PHP Sessions

Recommended Posts

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?

Link to comment
Share on other sites

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 by sherwin_flight
Adding info
Link to comment
Share on other sites

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'}

Link to comment
Share on other sites

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 by sherwin_flight
Added info
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated