mikechacra Posted January 28, 2016 Share Posted January 28, 2016 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. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 28, 2016 Share Posted January 28, 2016 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; } ?> 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.