Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-04-22
15
Medium Priority
?
258 Views
Last Modified: 2013-12-12
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
0
Comment
Question by:FirstBorn
  • 8
  • 7
15 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16542354
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16543896
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16592331
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16604166
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16604654
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16604670
Is that AFTER they have downloaded and saved the file? Are they automatically opening the file?
0
 
LVL 1

Author Comment

by:FirstBorn
ID: 16606192
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16612610
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16617346
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16629014
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16634735
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16637263
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16644562
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
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 2000 total points
ID: 16646306
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
 
LVL 1

Author Comment

by:FirstBorn
ID: 16714443
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question