Jump to content

find if a user is logged in from outside whmcs


ssswdon

Recommended Posts

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?

Link to comment
Share on other sites

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>


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.

Guest
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