Encrypted Download Scripts Not Working Properly... Please Help.

Hi,

I have php scripts that encrypt a download link for an ebook that appears to be working fine for Me and a few other people,
but there have been MANY Complaints that others have NOT been able to download the ebook for some reason.

This is VERY Frustrating because it WORKS for ME...

I have 3 ways to access the encrypted download link:
1.  Via Email Sent to the visitor after entering a Valid email address;
2.  Link Generated on form AFTER Email Address has been submitted;
3.  Instantly on the Form when accessed Directly from a link.

EACH and EVERY Link and procedure WORKS for ME...
However, They have only worked for a Select Few...
ALL Others that have attempted to access and/or download the file cannot and I
have NO CLUE Why!

The Scripts are zipped Up with Database info along with the testfile.pdf file for download using the scripts
and have been placed on the webserver here:
http://www.specialneedschildrennetwork.com/ee.php

I have a READ ME File included to assist in the database name and table defs for creating and inserting the first record
(so that the testfile.pdf file can be downloaded using these scripts.)

My Webserver uses:
----------------------------------------------
PHP version        4.4.1
MySQL version       4.0.25-standard
----------------------------------------------

Thank You VERY MUCH for Your Help!

Respectfully,

FirstBorn
LVL 1
FirstBornAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
Without going into the specifics, some things to look at.

1 - Are you requiring cookies/javascript? Don't.

2 - Do they get ANY error messages?
0
FirstBornAuthor Commented:
Hi RQuadling,

Thanks for being the First to Respond.

Here are the Answers to Your Response:
1.  Nope. Neither are being used.
2.  Two of them had 'file corrupt' errors,
The Others that had problems downloading the file(s) didn't give specific errors,
They just said that they couldn't Download the File(s).

I've tested it successfully from different PCs, so I have NO Clue as to why this is happening sporadically.

I even PAID for these scripts, so they were Professionally written.
(I didn't have the time to write them Myself.)

My Main Concern is that I wanted the Download Link Encrypted so that it wouldn't give the REAL Location of the files.
(I Especially wanted the .pdf files in just ONE Directory so that I can keep everything Organized.)

A LOT of the customers downloading (or ATTEMPTING to Download) these files have AOL, so
that gives the Extent of the problem being that these people have NO Clue on how to even USE a PC,
if You know what I mean.

I am able to email them Directly with the Files, but that Defeats the Purpose...
ESPECIALLY Since it's the SAME File that is on the Webserver.
(... and Yep, I'm Able to download the file and read it with NO Problems Myself.
Even on Other PCs.)

Any Ideas?

Thanks.

FirstBorn
0
FirstBornAuthor Commented:
k... I think that I found the problem.

I found out that whenever someone is using a mac (os) (and an occasional windows aol user,) that they are unable to download the file(s).
Is there a work around to this?

This has happened a few times and it seems to be a pattern.

Are there Any Known Issues for mac users viewing / downloading from a .php site?

Thank You Very Much for Your Help.

FirstBorn
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Richard QuadlingSenior Software DeveloperCommented:
The only thing I can think of is that on a MAC, the line endings are different.

DOS/Windows = /r/n = Carriage Return and Line Feed
Unix = /n
MAC = /r (I THINK!!!!)

But even then, not sure why the browsers deal with this differently.

Are you getting ANY error messages? You may find that they are somehow restricted from downloading files! There could be local security issues at play. Are they denied or do they get a page not found or what?
0
FirstBornAuthor Commented:
Hi Richard,

I just got this info from one of the people having the d/l problem that's using a mac:

Here is the Error Message:
"AN ERROR OPENING THIS DOCUMENT> A FILE READ ERROR HAS OCCURED"

They're able to open the file when I email it to them Directly, though.

I'm Able to d/l the file(s) and open them on 3 different PCs, and
others are able to d/l and open the file, too, so the file(s) aren't corrupt...

Thanks.

FirstBorn
0
Richard QuadlingSenior Software DeveloperCommented:
Is that AFTER they have downloaded and saved the file? Are they automatically opening the file?
0
FirstBornAuthor Commented:
When they go to the page to download the file, it seems that it isn't being saved as a .pdf file.

If You set up the scripts that I've included in this Q,
You'll see that it is an encrypted d/l link.

So, it seems that the mac isn't recognizing the download because the .pdf file is downloaded in a
different filename or format.

Here is an snippet of an email regarding this issue from someone that has a mac that has experienced this problem:

"I think the simple solution to this complicated problem is for him/her to send me the PDF file with a .pdf file extension
This will allow my Emac to open your file with a minimum of time, aggravation and might just solve the MaC  incompatibility "issue"
"

The File IS a .pdf file, so, evidently, they are not getting it as a .pdf file using the encrypted d/l link.

Thanks.

FirstBorn
0
Richard QuadlingSenior Software DeveloperCommented:
Can you supply a valid link that I can use to attempt a download from your site? I know this may be a security issue, so if you do not want to make the details public, you can ICQ:1711757, AIM:RasterUK, Yahoo:spam_free_life or MSN:richard.quadling@carval.co.uk (Thank you Trillian!).
0
FirstBornAuthor Commented:
Hi Richard,

Thanks.

k... I'll post 2 of the ebook d/l links here.
There are Multiple d/l pages, and that's because America OFF line customers
and people using a mac have problems downloading from EACH of the links for some
reason.

*****************************************************
2 Magic Foods -
How To Double Your ENERGY & Reverse Aging (Flax Oil Report)
*****************************************************
Secure:
http://ebook.enchantednlp.com/dlp/2magicfoods.php
OLD Method with NO SECURITY! Use at YOUR Own RISK!!!
http://orders.enchantednlp.com/old/2mfdlpo.php
THIRD Option if Your Customers are
having problems with ALL of the Links Above:
http://orders.enchantednlp.com/old/2mfsthankyou.php 
***********************************************
DreamHost Server Download Pages using dlp
***********************************************
2 Magic Foods -
How To Double Your ENERGY & Reverse Aging (Flax Oil Report)
http://ebook.nlpbrainbuzz.com/dlp/2mfdlpo.php


*****************************************************
Frankenstein Hypno-Handshake
*****************************************************
Secure:
http://ebook.enchantednlp.com/dlp/hypnohandshake.php
OLD Method with NO SECURITY! Use at YOUR Own RISK!!!
http://orders.enchantednlp.com/old/fhhdlpo.php
THIRD Option if Your Customers are
having problems with ALL of the Links Above:
http://orders.enchantednlp.com/old/fhhthankyou.php
***********************************************
DreamHost Server Download Pages using dlp
***********************************************
Frankenstein Hypno-Handshake
http://ebook.nlpbrainbuzz.com/dlp/fhhdlpo.php 

********************************************************

Thanks, Again.

FirstBorn
0
Richard QuadlingSenior Software DeveloperCommented:
http://ebook.enchantednlp.com/flaxoil/flaxoil.pdf

Headers. All look OK.

HTTP/1.1 200 OK
Via: 1.1 BANDEXCH
Content-Length: 65483
Date: Mon, 08 May 2006 08:20:49 GMT
Content-Type: application/pdf
Server: Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 PHP/4.4.2 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a mod_log_bytes/1.2
Last-Modified: Wed, 11 Jan 2006 23:18:10 GMT
ETag: "1138d51-ffcb-43c59232"
Accept-Ranges: bytes
Keep-Alive: timeout=15, max=100


Based upon http://ebook.enchantednlp.com/dlp/2magicfoods.php

HTTP/1.1 200 OK
Via: 1.1 BANDEXCH
Content-Length:
Date: Mon, 08 May 2006 08:27:52 GMT
Content-Type: application/force-download
Server: Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 PHP/4.4.2 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a mod_log_bytes/1.2
X-Powered-By: PHP/4.4.2
Accept-Ranges: bytes
Content-Disposition: attachment; filename=flaxoil.pdf

The content-length is empty. This results in a zero length file being successfully saved to my disk. This was in IE6. In FF I got a 6269 byte file.

Try the length first. Let me know and I'll retest.
0
FirstBornAuthor Commented:
Hi Richard,

Before I make the changes, I have a Quick Q...

Do I NEED to have the "Content-Length:" set?
If So, is there a 'Default' type setting that will work?

Thanks.

FirstBorn
0
Richard QuadlingSenior Software DeveloperCommented:
As the header is present you HAVE defined the length as 0.

If the header is NOT set then the client will probably receive the data and then time out and work with what it has got.

With the header set correctly, it will work.

Personally, you should ALWAYS supply a length. This will allow the client to know how long it will take to download and how far it has got.
0
FirstBornAuthor Commented:
Hi Richard,

k... I was going through the scripts and found that Line 239 of getfile.php has the following code:
      $FileSize = filesize($FullPath);

THIS SHOULD Be setting the file length, am I correct?

If So, then why is it Not Setting it?
If Not, Where would I set this?

Thanks.

FirstBorn
0
Richard QuadlingSenior Software DeveloperCommented:
Time to see some code then. I would also add ...

<?php
error_reporting(E_ALL);
?>

temporarily. This will show any errors/warning/ related to the

Debugging too.

Temporarily offline the downloads and echo $FileSize and $FullPath to make sure they are correct.


Ah.

Looking at the code.

You will see that in line 239 the variable $FileSize is defined but never used!!!!

In dlss.php Line 241 the same issue.

So it looks that in some instances the filesize of 0 is ignored or bypassed.

So, try changing $FileSize to $Size and then see what happens.

Also try using IE and FireFox for testing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FirstBornAuthor Commented:
Hi Richard,

Had some minor testing done and it appears that the "$FileSize" to "$Size" suggestions was the Answer.

Thank You VERY Much for Your Help.

FirstBorn
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.