Jump to content

$loggedin fails


leon_nerd

Recommended Posts

Hi,

 

I am customizing viewinvoice.tpl and I need to show some client details over there. I used {if $loggedin} some code {/if} but it fails. It is not reading the $loggedin as true even though the SESSION[uid]=1.

 

Any ideas how can I read the if the user is logged in or not. I can use {php} if($_SESSION[uid]>0){ {/php} but I am wondering why $loggedin is failing?

 

Thanks.

Link to comment
Share on other sites

<html>
<head>
<title>{$companyname} - {* This code should be uncommented for EU companies using the sequential invoice numbering so that when unpaid it is shown as a proforma invoice {if $status eq "Paid"}*}{$LANG.invoicenumber}{*{else}{$LANG.proformainvoicenumber}{/if}*}{$invoicenum}</title>
<link rel="stylesheet" type="text/css" href="templates/{$template}/invoicestyle.css">
<link rel="stylesheet" type="text/css" href="templates/{$template}/css/master.css" />
<script type="text/javascript" src="includes/jscript/jquery.js"></script>
</head>
<body bgcolor="#efefef">

{include_php file="templates/$template/navigation.php"}

   {if $loggedin}
   <br /><br />
   <strong>Welcome, {$clientsdetails.firstname} {$clientsdetails.lastname}</strong><br />
   <table width="150" cellpadding="2" cellspacing="0" align="left">
   <tr>
       <td width="110">
           <a href="clientarea.php?action=products">My Products</a>
       </td>
       <td>{$clientsstats.productsnumtotal}</td>
   </tr>
   <tr>
       <td>
           <a href="clientarea.php?action=domains">My Domains</a>
       </td>
       <td>
           {$clientsstats.numdomains}
       </td>
   </tr>

   <tr height="20">
       <td>
           <a href="supporttickets.php">Support Tickets</a>
       </td>
       <td>
           {$clientsstats.numtickets}
       </td>
   </tr>
   <tr>
       <td colspan="2" align="right">

           {php}
           if(count($_SESSION['cart']['products'])==0){
               echo "Cart is empty"; 
           }else{
               echo "<a href='cart.php?a=view'>View Cart</a>";
              }
           {/php}


          | <a href="logout.php">Logout</a>
       </td>
   </tr>
   </table>
   {else}

   {include_php file="templates/$template/loginpanel.php"}

   {/if}

</div>

 

This is from viewinvoice.tpl file. There is more code below it but this shows the use of $loggedin here. It fails to read the value of $loggedin even though the SESSIONS array contains a non-zero value for 'uid'.

Link to comment
Share on other sites

Are you sure $loggedin is set with viewinvoice? Thought view invoice required login anyway. Perhaps it isn't set?

 

This got me curious so I tested it. $loggedin doesn't appear to have a value. Which makes sense, since you need to be loggedin to view an invoice anyway--right?

Link to comment
Share on other sites

Are you sure $loggedin is set with viewinvoice? Thought view invoice required login anyway. Perhaps it isn't set?

 

This got me curious so I tested it. $loggedin doesn't appear to have a value. Which makes sense, since you need to be loggedin to view an invoice anyway--right?

 

Yes you are right that we need to log in to view the invoice. But, once we log i it should return $loggedin as true. Right?

 

That's the problem in my case. I log into the client area. I then check my invoice and $loggedin fails to return TRUE and hence skips the code.

 

I hope that I got your point rightly. :| Let me know if I am missing something here.

Link to comment
Share on other sites

Howdy Leon,

My point was that I don't believe the page (viewinvoice) is even accessible without being logged in.

 

Therefore, it doesn't set the variable. Basically, you do not need to check whether a user is loggedin or not, because if they're viewing the page—they are.

 

So you could remove this check.

Link to comment
Share on other sites

Howdy Leon,

My point was that I don't believe the page (viewinvoice) is even accessible without being logged in.

 

Therefore, it doesn't set the variable. Basically, you do not need to check whether a user is loggedin or not, because if they're viewing the page—they are.

 

So you could remove this check.

Aaahh....I got your point. Thanks for the wonderful suggestion. Let me try it out and see if it works. Theoretically, it SHOULD work.

 

I will update this thread soon with the results.

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