Jump to content

create whmcs 6 feed to check if client is logged in


mikechacra

Recommended Posts

Hello,

 

I'am trying to check if a user is logged and display the first name from outside whmcs folder. I'am using feeds. I have created checkifloggedin.php in the feeds folder.

<?php
require("../init.php");    
if (isset($_SESSION['uid'])) {

   /*i can get the the id of the user but i cannot display the first
     name of the logged in user. tried several methods but i cannot
     make it work.*/

   widgetoutput();
   }
else {
   widgetoutput('logged out');
}

function widgetoutput($value) {
   echo "document.write('".addslashes($value)."');";
   exit;
}

?>

 

any help from you guys would be so appreciated.

 

Thanks a lot.

Link to comment
Share on other sites

simple query to database will give you client information

 

<?php
require("../init.php");    
if (isset($_SESSION['uid'])) {

   $select_clientinfo = full_query("SELECT firstname,lastname FROM tblclients WHERE id='".$_SESSION['uid']."'");
   $clientinfo = mysql_fetch_assoc($select_clientinfo);

   /*i can get the the id of the user but i cannot display the first
     name of the logged in user. tried several methods but i cannot
     make it work.*/

   widgetoutput($clientinfo['firstname']." ".$clientinfo['lastname']);
   }
else {
   widgetoutput('logged out');
}

function widgetoutput($value) {
   echo "document.write('".addslashes($value)."');";
   exit;
}

?>

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