Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Downloads Controller v5.3, PHP in Safe mode, no download


Maximus

Recommended Posts

Using Downloads Controller v5.3, PHP in Safe mode

 

1. I got a blank order_id being passed to download.php from account_info_history.php.

 

This is due to upgrading from Downloads Controller v5.0; when you're using v2.2 MS1 and not spotting in /modules/downloads.php

 

$downloads['orders_products_download_id'])

 

Which used to be $downloads_values['orders_products_download_id']) in an earlier osCommerce version.

 

2. If you're running SAFE MODE then in download.php, the symlink to create a softlink in /pub from /dowload will not work.

 

You can get around this by turning download by re-direct off in the osCommerce config. This is a big overhead as the file to be downloaded gets read twice.

 

Is there a PHP GURU out there who knows a better way of achieving symlink functionality, please?

 

Be aware that during testing, your down load count might reach zero and your download will no longer be available. I have seen at least one threa on this topic area where the user got confused by this red herring. :?

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

:evil: It doesn't work, I have lost a lot of time in this

 

Oh, it definitely DOES work. You need to follow the instructions exactly in that you start with 2.2 ms1 etc.

 

The only part that does not work is symlink with PHP in SAFE mode and I detailed the workaround which is a bit resource heavy - so I was asking for a "resource light" alternative to symlink.

 

Best regards to Linda for the excellent contribution.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

Well, I must say... it was weeee early hours when I tried this :)

 

I have tried it again and it seems to work :)

 

Thanks for the inspiration Maximus :)

 

Ill keep ya updated on any errors if any ;)

Link to comment
Share on other sites

Im not too sure about this

 

Changes to /catalog/includes/application_top.php

 

Replace the line:

 

// Shopping cart actions

 

Replace with:

 

// BOF: WebMakers.com Added: Functions Library

include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');

// EOF: WebMakers.com Added: Functions Library

 

// Shopping cart actions

 

 

This now what I have

$navigation->add_current_page();

 

// BOF: WebMakers.com Added: Functions Library

include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');

// EOF: WebMakers.com Added: Functions Library

 

// Shopping cart actions

 

 

I have the $navigation->add_current_page(); there just so you know where im beginning

 

is this correct??

Link to comment
Share on other sites

I am glad you're re-inspired to use this contribution. :wink: Its pretty good once you work out the status for each payment method.

 

I think you're bing too cautious now, as regards applictaion_top... you should end up with this

 

$navigation->add_current_page();

 

// BOF: /* Ftimes WebMakers.com Added: Functions Library

include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');

// EOF: WebMakers.com Added: Functions Library

 

// Shopping cart actions

 

which seems to be what you have done already.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

I had to uninstall it :(

 

I came up with other errors, is there any way to allow users whom purchse access to the download after the payment(s) have been verified without having to go into admin??

 

If so can you please describe to me ?

 

Thanks alot :)

 

:wink:

Link to comment
Share on other sites

>Oh, it definitely DOES work. You need to follow the instructions exactly in that you start with 2.2 ms1 etc.

 

You say it does work and that you only need follow the instructions, but I don't see that in mine.

 

>Replace the line:

>

>// Shopping cart actions

>

>Replace with:

>

>// BOF: WebMakers.com Added: Functions Library

>include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');

>// EOF: WebMakers.com Added: Functions Library

>

>// Shopping cart actions

 

Where the hell you got it? I didn't see that in v.5_3. Is there another instructions in some other side?

 

regards

 

Raul

Link to comment
Share on other sites

I had to uninstall it :(

 

I came up with other errors, is there any way to allow users whom purchse access to the download after the payment(s) have been verified without having to go into admin??

 

If so can you please describe to me ?

 

Thanks alot :)

 

:wink:

 

This is controlled by the staus set in each payment module. Some site owners comnplained that customers made a paypal payment of less than the amount due and automatically got access to their download. All this is described on another thread here.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

>Oh, it definitely DOES work. You need to follow the instructions exactly in that you start with 2.2 ms1 etc.  

 

You say it does work and that you only need follow the instructions, but I don't see that in mine.  

 

>Replace the line:  

>

>// Shopping cart actions  

>

>Replace with:  

>

>// BOF: WebMakers.com Added: Functions Library  

>include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');  

>// EOF: WebMakers.com Added: Functions Library  

>

>// Shopping cart actions  

 

Where the hell you got it? I didn't see that in v.5_3. Is there another instructions in some other side?  

 

regards  

 

Raul

 

It doesn't say "start with 2.2 ms1 etc." but I realised that you did have to.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

 

It doesn't say "start with 2.2 ms1 etc." but I realised that you did have to.

 

Excuse my poor english but I don't understand you. I have, sure, the last release of oscommerce (this is what you say 2.2 ms1, isn't it?).

 

That to which I talk about is the instructions that you have copied in your message, I don't see that in the instructions of the Download controller.

 

There is nothing about

 

>// Shopping cart actions

 

there. Where do you see this instructions? May be I don't have the right one?

 

Thanks

 

Raul

Link to comment
Share on other sites

I did not understand you either, sorry.

 

My install notes include

 

"

Changes to /catalog/includes/application_top.php

 

Replace the line:

 

// Shopping cart actions

 

Replace with:

 

// BOF: WebMakers.com Added: Functions Library

include(DIR_WS_FUNCTIONS . 'webmakers_added_functions.php');

// EOF: WebMakers.com Added: Functions Library

 

// Shopping cart actions

"

 

So it appears that you have the wrong install notes.

 

You should be using Download Controller MS1 v5.3 BUT you must also use the instructions from Download Controller MS1 v5.0.

 

If you do not use both sets of instructions then maybe that is why you cannot get it to work - not your fault at all then :wink:

 

I will pm you the full instructions. I will not post them here because my instructions may confuse people using v5 and v5.3

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

Ok, thanks. If I understand, I must install the previous versions before the 5.3, isn't it?

 

Yes, qui, exactement, bien sure

 

:wink:

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

Well, I have made progresses since last time. Now I arrive until the download page and I can see de buttom added for the downloads, but since I clikc on, I get this:

 

The page cannot be found

 

Any idea?

Link to comment
Share on other sites

yes, I started the thread with that problem !!

 

is your PHP parser in SAFE mode ? If so then its the same issue.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

yes, I started the thread with that problem !!

 

OH YES!!! it works :D

 

Thanks a lot

 

I am very glad for you.

 

Now can you help me please?

 

If you find a way of doing what symlink does with PHP in SAFE mode, please please tell me.

 

The way we're doing it now 'copies' the file which is resource hungry.

 

Please excuse my poor French!. 8)

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

:shock: Ay ayay

 

I have not clue what are you talking about, I'm a lawyer :P

Nevertheless I've found this:

 

(http://www.zend.com/manual/features.safe-mode.functions.php)

Functions restricted/disabled by safe mode

This is a still probably incomplete and possibly incorrect listing of the functions limited by safe mode

 

symlink() Checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. Checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed. (note: only the target is checked)

 

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

 

And this other

 

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

 

http://be2.php.net/symlink

Here is a simple way to control who downloads your files...

 

You will have to set: $filename, $downloaddir, $safedir and $downloadURL.

 

Basically $filename is the name of a file, $downloaddir is any dir on your server, $safedir is a dir that is not accessible by a browser that contains a file named $filename and $downloadURL is the URL equivalent of your $downloaddir.

 

The way this works is when a user wants to download a file, a randomly named dir is created in the $downloaddir, and a symbolic link is created to the file being requested. The browser is then redirected to the new link and the download begins.

 

The code also deletes any past symbolic links created by any past users before creating one for itself. This in effect leaves only one symbolic link at a time and prevents past users from downloading the file again without going through this script. There appears to be no problem if a symbolic link is deleted while another person is downloading from that link.

 

This is not too great if not many people download the file since the symbolic link will not be deleted until another person downloads the same file.

 

Anyway enjoy:

 

$letters = 'abcdefghijklmnopqrstuvwxyz';

srand((double) microtime() * 1000000);

$string = '';

for ($i = 1; $i <= rand(4,12); $i++) {

$q = rand(1,24);

$string = $string . $letters[$q];

}

$handle = opendir($downloaddir);

while ($dir = readdir($handle)) {

if (is_dir($downloaddir . $dir)){

if ($dir != "." && $dir != ".."){

@unlink($downloaddir . $dir . "/" . $filename);

@rmdir($downloaddir . $dir);

}

}

}

closedir($handle);

mkdir($downloaddir . $string, 0777);

symlink($safedir . $filename, $downloaddir . $string . "/" . $filename);

Header("Location: " . $downloadURL . $string . "/" . $filename);

 

**********

 

:idea: I've seen that Linda has open a trhead about Download controller, perhaps she can help you.

 

I can excuse your poor french, c'est une foutue langue que je n'arrive pas a bien ?crire, but you must learn Spanish :wink:

 

Saludos

 

Raul

Link to comment
Share on other sites

Thank you Raul

 

I did not mean for you to do my research. I can do that - exactly how stupid do you think I am? But I thank you very much for your kind ideas & gestures. They are truly appreciated in this this unappreciative world.

 

I still cannot find an alternative to symlink that will also work under safe mode. Those sites just say that you cannot do it.

 

Maybe the only answer is the way we're doing it already but speaking as a programmer (but not a PHP or Linux programmer), there is always a cheap way to do everything but to know this you have to break away from your farmer.

 

Congratulations on your knowledge of many languages.

 

We in England are so stupid that we still believe that there is no world outside of the English speaking world. Why else would David Beckham leave to live in Spain? Is that 'world' or farm?

 

www.pccontemporary.com

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

Link to comment
Share on other sites

  • 3 weeks later...
Hi Did you find any solution for downloads under safe mode = "on" from redirect via pub directory

 

No replacement for symlink as I am too old to become a PHP expert but the workaround that this thread started with does work.

WHO AM I

WHERE AM I I AM SO SMALL

WHEN AM I I AM SO FLEETING

INSIGNIFICANT TO THE POINT OF NOTHING I AM THE MEASURE

OF ALL THINGS

WHEN YOU READ ME YOU UTTER MY NAME

WHO AM I

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...