ssswdon Posted August 31, 2009 Share Posted August 31, 2009 Hi. I am trying to figure our how find out if a user is logged in from outside the whmcs folder. I would prefer to include a template but I get the all the templating. I only need to return a div. I have added a template with the code but I get the whole page, not just the contents of the .tpl file So if I could find out how to create a page and template that only outputs what in the .tpl file, is this possible. Is there a way to call some page to determine if a user is logged in? 0 Quote Link to comment Share on other sites More sharing options...
ssswdon Posted August 31, 2009 Author Share Posted August 31, 2009 OK, I finally was able to figure it out. Here is what I am doing. 1.) Create a page under whmcs, here is the code. This will return the results or a div if you like. <?php define("CLIENTAREA",true); require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); if ($_SESSION['uid']) { echo "a div to display - Welcome whmcs user - <a>Logout</a>"; } else { echo "this should be the login form div"; } ?> 2.) from a page outside of whmcs use something like this to get the results, in my case I am using jquery. This puts the results into the div with id login. <html> <head> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $.get("whmcs/test.php", function(data){ $('div#login').append(data); }); </script> </head> <body> <div id="login"> </div> </body> </html> 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.