Jump to content
shwoo

Download Invoice redirects to login screen

Recommended Posts

I'm having issues with the "Download" link on the bottom of the invoice on viewinvoice.php in the Client Front End.

 

<a href="dl.php?type=i&id={$invoiceid}">{$LANG.invoicesdownload}</a>

 

Instead of downloading a .pdf like it does in the Admin backend it redirects to the login page. Once logged in it does not produce the .pdf either...

 

I've had a look at viewinvoice.tpl and dl.php and can't really see anything out of order.

 

Any ideas??? Thanks!

Share this post


Link to post
Share on other sites

SOLVED! (always the way just after you post!)

 

It was occurring because the redirect was going to https://www and my SSL was setup with no www.

 

I simply added the full domains name to the dl.php link shown above.

Share this post


Link to post
Share on other sites

I am having the same issue downloading invoices from the admin area of WHMCS when i click on either 'view PDF' or 'download PDF', it takes me to a login screen.

If i simply remove the 'www.' from the start of the URL so that it matches how my SSL is setup, the PDF then downloads.

I can't change the code from within the invoices.php file because its all encrypted.

 

Is there any other way to get around this?

Share this post


Link to post
Share on other sites

After 8 years of this thread , the issue is still present in the new version of WHMCS (2021) Version: 8.1.3

I've tried what the OP suggested (editing template file, with full path in the "dl.php" link ) and nothing.   It still redirects to LOGIN page "Login This page is restricted"

Then I tried ALL combinations under configurations / general settings page:

- With or without WWW   ( WHMCS System URL )

- All 3 options of Redirects:  BASIC, Full Friendly, FRIENDLY index.php

Nothing solves the issue.  Customer is still not allowed to download a simple invoice, because after clicking on "download" button the user is being Logged out and redirected to LOGIN page again.

My SSL certificate covers both: my domain with or without "www".

What could it be the problem here?

 

Share this post


Link to post
Share on other sites
2 hours ago, perdtmdehwhp said:

What could it be the problem here?

custom theme? does the same thing happen even if using Six or 21 ?

Share this post


Link to post
Share on other sites

I'm using SIX template only.  But yes, It happens with 21 too (I just tested).

I edited invoicepdf.tpl in SIX template only (21 was untouched)  and  just basic conditions to customize the "UNPAID" stamp. I just posted the small changes here:  

 

Also, it works when I impersonate the customer ("Login as owner" link) under my ADMIN portal.  It downloads the PDF perfectly.  The issue comes when customers log into their account by themselves (not through Admin/portal impersonation).

Share this post


Link to post
Share on other sites
12 minutes ago, perdtmdehwhp said:

Also, it works when I impersonate the customer ("Login as owner" link) under my ADMIN portal.  It downloads the PDF perfectly.  The issue comes when customers log into their account by themselves (not through Admin/portal impersonation).

i'm seeing that on v8.1.3 - but it works fine on v8.0.4  - out of interest, have you submitted a bug report or opened a ticket with support ?

16 minutes ago, perdtmdehwhp said:

I just posted the small changes here:  

yeah I read about your date troubles.... that's fixable tomorrow....

been a long day watching the Nominet EGM - there's more clowns on that board than in a circus.. they can't even get the vote results out on time or even an hour later. 🤡

Share this post


Link to post
Share on other sites
7 minutes ago, brian! said:

have you submitted a bug report or opened a ticket with support ?

No yet, but I will.

8 minutes ago, brian! said:

yeah I read about your date troubles.... that's fixable tomorrow....

No prob, thanks for replying.

Share this post


Link to post
Share on other sites

Anyone please help me I have same problem when I download my invoice from clientarea its redirected me to login page

Share this post


Link to post
Share on other sites
Posted (edited)
On 25/03/2021 at 19:18, SB SMART said:

Anyone please help me I have same problem when I download my invoice from clientarea its redirected me to login page

i've just tried replacing dl.php with the equivalent version from v8.0.5 and it seems to work.

I suspect that is where the bug is in this issue - if so, then it should be easily fixed with a hotfix from WHMCS.

Edited by brian!

Share this post


Link to post
Share on other sites

I would suggest is editing the server's PHP configuration and replacing the "pdo_mysql" extension with "nd_pdo_mysql" as I've seen "pdo_mysql" (which has some issues currently) cause the same issue on other installations recently, and replacing it resolved it

Share this post


Link to post
Share on other sites

Hi,

Do you use CloudLinux at all?

If so, please try switching from pdo_mysql to nd_pdo_mysql (native driver) within the Cloudlinux PHP configuration and check again.

The CloudLinux pdo_mysql build appears to have some quirks about the way it handles integers (or at least we have observed unexpected behavior), but the native driver does not.

Share this post


Link to post
Share on other sites

that seems to solve it too - has this issue been assigned a CORE number ?

Share this post


Link to post
Share on other sites

Hi @brian!,

We have an internal case open with the development team to explore this is in more detail, but our present understanding is that this relates to that driver and the way it handles integers, thereby not being a deficiency in the WHMCS software.

Whilst I cannot speak for the intentions of the development team, I would anticipate the resolution I provided to become documented, with the potential of a check being implemented within WHMCS to alert users to it, though that is only my anticipated outcome of the aforementioned internal case and not a confirmation that will become the result of it.

I hope that helps.

Share this post


Link to post
Share on other sites
2 hours ago, WHMCS Alex said:

We have an internal case open with the development team to explore this is in more detail, but our present understanding is that this relates to that driver and the way it handles integers, thereby not being a deficiency in the WHMCS software.

yet that situation doesn't occur with the v8.0.5 version of the dl.php file... so what is that file doing that the v8.1 versions aren't ?

2 hours ago, WHMCS Alex said:

Whilst I cannot speak for the intentions of the development team, I would anticipate the resolution I provided to become documented, with the potential of a check being implemented within WHMCS to alert users to it, though that is only my anticipated outcome of the aforementioned internal case and not a confirmation that will become the result of it.

so you expect the solution to be to allow the issue to continue, causing embarrassment for those using WHMCS to have clients unable to download their invoices ? they're inevitably going to create support tickets.. and maybe it's just me, but I would have thought it better for all parties to prevent the situation occurring in the first place, rather that waiting for tickets to arrive and then spending time directing them to a docs page that tells them to tweak their php settings... even a passing line in the system health status page about this would probably go unnoticed by most users.

Share this post


Link to post
Share on other sites
3 hours ago, brian! said:

so you expect the solution to be to allow the issue to continue, causing embarrassment for those using WHMCS to have clients unable to download their invoices ? they're inevitably going to create support tickets.. and maybe it's just me, but I would have thought it better for all parties to prevent the situation occurring in the first place, rather that waiting for tickets to arrive and then spending time directing them to a docs page that tells them to tweak their php settings... even a passing line in the system health status page about this would probably go unnoticed by most users.

I agree with Brian.  I have no experienced this issue with former versions, but I do now with the latest "stable", which is supposed to be better than former ones.  I don't use CloudLinux, nor Cpanel.   I use Virtualmin.  And my server works perfectly fine with multi-version of PHP-FPM 7.2 / MariaDB version 5.5.68   for all my clients, and Everything works, including Wordpress sites.  The only "PHP/MySQL" issue that my server has now is with this "redirecting to login" behavior from WHMCS last version. 

Share this post


Link to post
Share on other sites

ahhhh... so happy to see that i'm not the only one having/noticing this issue.  a client of mine brought it to my attention last week.  i had searched online for others having the same problem, but stumbled upon this old thread.  i'm happy to see that thread has new life and that i'm not the only one having this issue!

Share this post


Link to post
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