girl Posted March 29, 2008 Posted March 29, 2008 Hello, When a person buys a download product and their download counts or time have expired I would like them to be sent to a page with a nice message lets call it "DOWNLOAD_END.php" , instead of the present blank screen which they get. How do I adjust this code - // Die if time expired (maxdays = 0 means no time limit) if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) die; // Die if remaining count is <=0 if ($downloads['download_count'] <= 0) die; // Die if file is not there if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die; Thanks for any help that can be given.
germ Posted March 29, 2008 Posted March 29, 2008 Maybe something like this: // Die if time expired (maxdays = 0 means no time limit) if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) ( header('Location: DOWNLOAD_END.php'); } // Die if remaining count is <=0 if ($downloads['download_count'] <= 0) ( header('Location: DOWNLOAD_END.php'); ) // Die if file is not there if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die; BACKUP FIRST!!! If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
germ Posted March 29, 2008 Posted March 29, 2008 And if you code DOWNLOAD_END.php with this line at the top (like most of the other osC files): require('includes/application_top.php'); I don't think they'll get logged out. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
girl Posted March 29, 2008 Author Posted March 29, 2008 Thanks Jim, that has helped. I found that when a person downloads, the page is not automatically refreshed so if they attempted to download more than the alloted number they get the blank page. I just copied one of the osc basic pages eg privacy.php and so when I hit continue it is returning the person to index without logging them out. // Die if time expired (maxdays = 0 means no time limit) if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) ( header('Location: DOWNLOAD_END.php'); ) ;) // Die if remaining count is <=0 if ($downloads['download_count'] <= 0) ( header('Location: DOWNLOAD_END.php'); ) // Die if file is not there if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die; I am sure your code is right. however I found I had to do this otherwise I was getting a ; error (I have no idea why) // Die if time expired (maxdays = 0 means no time limit) if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) ( header('Location: download_expired.php')); // Die if remaining count is <=0 if ($downloads['download_count'] <= 0) ( header('Location: download_expired.php')); // Die if file is not there if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die;
Recommended Posts
Archived
This topic is now archived and is closed to further replies.