Jump to content

Integration Code - Don't show Client Login if they are Logged in


davet

Recommended Posts

  • 1 month later...
  • 1 month later...
hi Sparky, im a usuly a sample and like more think to using a template Smarty in my code, please a post from a sample code complete from development a new pages in WHMCS

Please be a little clearer in your english. I don't understand what me mean.

Link to comment
Share on other sites

  • 2 weeks later...

how do you include the language file in the client area

 

@sparky, Im need help to develop pages in client area, and use a example http://whmcs.blog.br/principal/criando-uma-pagina-no-whmcs/comment-page-1/ now i'm need include a language file, why not appears text.

 

how can show a text in header.tpl

 

 

{$LANG.globalsystemname}{$LANG.clientareatitle}{$LANG.announcementstitle}{$LANG.knowledgebasetitle}{$LANG.supportticketspagetitle}

Edited by marlonsouza
Link to comment
Share on other sites

  • 2 months later...

my bad! I am not exactly an experienced php coder but this is what I gather so far...

 

?php
echo date("l F jS Y ");
require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");
if ($_SESSION['uid']) {
 $result = mysql_query("SELECT firstname,lastname FROM tblclients WHERE id=" . $_SESSION['uid'] . "");
 $data = mysql_fetch_array ($result);
 echo "<hr/><strong>Welcome Back</strong><br>";
 echo "<strong>{$data['firstname']}</strong> ";
 echo "<strong>{$data['lastname']}</strong><br><br>";
 echo "<br><br><form method=post action=http://domain.com/logout.php><input type=submit class=submitbutton value=Logout /></form>";

} else  {
 echo '<form method="post" action="http://domain.com/dologin.php?goto=clientarea">
<input type="hidden" name="token" value="##removed##" /> 
Email Address: <input type="text" name="username" size="50"><br>
Password: <input type="password" name="password" size="20"><br>
<input type="submit" value="Login"> 
</form>';
}
?>

 

Now I am just getting the login box despite the fact that I am logged in (as client). I suspect there's something that needs to be changed under the if ($_SESSION['uid']) statement? Care to lend us a hand?

Link to comment
Share on other sites

my bad! I am not exactly an experienced php coder but this is what I gather so far...

 

?php
echo date("l F jS Y ");
require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");
if ($_SESSION['uid']) {
 $result = mysql_query("SELECT firstname,lastname FROM tblclients WHERE id=" . $_SESSION['uid'] . "");
 $data = mysql_fetch_array ($result);
 echo "<hr/><strong>Welcome Back</strong><br>";
 echo "<strong>{$data['firstname']}</strong> ";
 echo "<strong>{$data['lastname']}</strong><br><br>";
 echo "<br><br><form method=post action=http://domain.com/logout.php><input type=submit class=submitbutton value=Logout /></form>";

} else  {
 echo '<form method="post" action="http://domain.com/dologin.php?goto=clientarea">
<input type="hidden" name="token" value="##removed##" /> 
Email Address: <input type="text" name="username" size="50"><br>
Password: <input type="password" name="password" size="20"><br>
<input type="submit" value="Login"> 
</form>';
}
?>

 

Now I am just getting the login box despite the fact that I am logged in (as client). I suspect there's something that needs to be changed under the if ($_SESSION['uid']) statement? Care to lend us a hand?

 

 

Looking at that you should only get the Welcome Back, Name and Logout Button... If you are logged out then you should see the Login Box.

Link to comment
Share on other sites

BAJI26: Yeah but even if I am logged in, I still see the login box.. Does it have to do with the fact that I have this login box outside the whmcs folder?

(I did do require("whmcs/dbconnect.php"); I just removed them from my post)

Link to comment
Share on other sites

  • 1 month later...

I use this in my header.tpl above the header image and it shows the login box until client logs on then it shows the welcome message and a logout link

 

 

What do you think, is there a way to clean up this code a bit?

 

Thanks!

 

----------------------------------------------------------------------

 

<table style="width: 100%" cellpadding="0">

<tr>

<td>

<div align="left">

{if $loggedin} Welcome back {$clientsdetails.firstname} {$clientsdetails.lastname}! :: <a href="logout.php">{$LANG.logouttitle}</a>

{else}

<form method="post" action="http://www.YOURSITE.COM/YOURDIRECTORY/dologin.php?goto=clientarea"><input type="hidden" name="token" value="FROMYOURWHMCSINTEGRATIONCODEFORLOGIN" /> Email Address: <input type="text" name="username" size="20">Password: <input type="password" name="password" size="12"><input type="submit" value="Login"> </form>

{/if}

</div>

</td>

</tr>

</table>

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

Here is the working code that works for me. What this does is adds the login information on your html site and connects to your whmcs database which is in another directory. This code was partly derived from Ronnie at Nextinspire.com and others that have posted on these forums with their various code.

 

<div id="header_login">
<?php require("clients/dbconnect.php");

if ($_SESSION['uid']) {

   $query="SELECT * FROM tblclients WHERE id='" .$_SESSION['uid'] . "'";

   $result = mysql_query($query) or die(mysql_error());
   if($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

     $clientsdetails['firstname']=$row['firstname'];
     $clientsdetails['lastname']=$row['lastname'];
     $clientsdetails['email']=$row['email'];

   }

   echo "

<ul>
<li>Welcome back  ".($row['firstname'])."!</li>
<li><a href=\"/clients/clientarea.php\" title=\"My Dashboard\">My Dashboard</a></li>
<li><a href=\"/clients/clientarea.php?action=changepw\" title=\"Change Password\">Change Password</a></li>
<li><a href=\"/clients/logout.php\" title=\"Logout\" style=\"border: none;\">Logout</a></li>
</ul>

   ";

} else {
 echo '<form method="post" action="http://domain.com/clients/dologin.php">
	<input type="hidden" name="token" value="xxxxxxxxxxxxxxxxxxxxxxxx" />
   <dl>
     <dt>Email Address  :</dt><dd><input type="username" type="text" name="username" class="inputbox" /></dd>
     <dt>Password  :</dt><dd><input name="password" type="password" name="password" class="inputbox" /></dd>
     <dd><button type="submit" class="BtnGo"></button></dd>
   </dl></form>';
} 

?> 
</div>

Link to comment
Share on other sites

Here is the working code that works for me. What this does is adds the login information on your html site and connects to your whmcs database which is in another directory. This code was partly derived from Ronnie at Nextinspire.com and others that have posted on these forums with their various code.

 

<div id="header_login">
<?php require("clients/dbconnect.php");

if ($_SESSION['uid']) {

   $query="SELECT * FROM tblclients WHERE id='" .$_SESSION['uid'] . "'";

   $result = mysql_query($query) or die(mysql_error());
   if($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

     $clientsdetails['firstname']=$row['firstname'];
     $clientsdetails['lastname']=$row['lastname'];
     $clientsdetails['email']=$row['email'];

   }

   echo "

<ul>
<li>Welcome back  ".($row['firstname'])."!</li>
<li><a href=\"/clients/clientarea.php\" title=\"My Dashboard\">My Dashboard</a></li>
<li><a href=\"/clients/clientarea.php?action=changepw\" title=\"Change Password\">Change Password</a></li>
<li><a href=\"/clients/logout.php\" title=\"Logout\" style=\"border: none;\">Logout</a></li>
</ul>

   ";

} else {
 echo '<form method="post" action="http://domain.com/clients/dologin.php">
	<input type="hidden" name="token" value="xxxxxxxxxxxxxxxxxxxxxxxx" />
   <dl>
     <dt>Email Address  :</dt><dd><input type="username" type="text" name="username" class="inputbox" /></dd>
     <dt>Password  :</dt><dd><input name="password" type="password" name="password" class="inputbox" /></dd>
     <dd><button type="submit" class="BtnGo"></button></dd>
   </dl></form>';
} 

?> 
</div>

 

For this code to work, will I need to use .php files or can .html files be used?

Link to comment
Share on other sites

  • 1 year later...
Well I'm trying to integrate it with Joomla as far as a wrapper is concerned so creating the extra pages within WHMCS is just not feasible

 

You are not creating an extra page in whmcs, you are creating an extra file that will be called by your external pages. the extra file is never meant to be called as a page/directly. the whole point of it is to allow you to use whmcs logins outside of whmcs root directory.

 

 

Failing that you could just bite the bullet and use whmcs as the website, adding pages is a very simple process..

 

 

Kingblink you would have a problem with this because the template files are not a complete layout, it takes several tpl files to create each and every page.

 

The only solution is to make the page in html in your wysiwyg and then convert (cut and paste) the html file into the correct sections so that the template matches your design. this isnt difficult to do, you just need to ensure that when you put together your template you use the whmcs layout to speed up the process of positioning the sections correctly.

 

Failing that, you can simply use your own design, + css and integrate into it in the templates the whmcs logic but the other way is less problematic.

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