Jump to content

Display login status outside whmcs folder


weblantis

Recommended Posts

See this link:

 

If you want to display one of the following login status messages on any PHP page outside of the whmcs folder:

 

  • Please Login or Register (if user has not logged in)
  • Welcome Back {first name} | My Details | Logout (displayed to logged in users)

 

My solution is a PHP solution, and here it is:

 

Create file called login_status.php and save it in the WHMCS folder. Then copy & paste the following code to this file:

 

<?php
require("dbconnect.php");
if ($_SESSION['uid']) {
$result = mysql_query("SELECT firstname FROM tblclients WHERE id='".$_SESSION['uid']."' LIMIT 1;");
   while($row = mysql_fetch_array($result))
      echo "<p id='login'>".$_LANG['welcomeback'].', '.$row['firstname'].' | <a href="/whmcs/clientarea.php"><strong>'.$_LANG['clientareanavdetails'].'</strong></a> | <a href="/whmcs/logout.php"><strong>'.$_LANG['logouttitle'].'</strong></a></p>';
}
else{
   echo "<p id='login'>".$_LANG['please'].' <a href="/whmcs/clientarea.php" title="Login"><bold>'.$_LANG['loginbutton'].'</bold></a> '.$_LANG['or'].' <a href="/whmcs/register.php" title="Register"><bold>'.$_LANG['clientregistertitle'].'</bold></a></p>';
}
?>

 

(You will notice that I included some css tags and html bold tags for styling purposes.)

 

Now include the following line of code on any php based web pages located outside of the whmcs folder:

 

<?php
include('pathto/whmcs/login_status.php');
?> 

 

That is it!

 

You don't need this solution if your entire website is built on whmcs.

 

However, in my case, whmcs is only one part of my website. the others parts of my website are my own custom web pages and a Wordpress installation. So by using this approach I can keep all my files organised and in separate folders.

Link to comment
Share on other sites

  • 1 year later...
  • 11 months later...
  • 5 weeks later...
i got the following messages after i include the codes on my wordpress site php pages: any help???????????? thanks

 

Down for Maintenance

An upgrade is currently in progress... Please come back soon...

 

This means that your WHMCS is in maintenance mode, you can change that from your General Settings.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

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