mostafatalebi Posted December 13, 2012 Share Posted December 13, 2012 (edited) Hello I am going to purchase a Download Host, and it does not support Database. I have to purchase a Regular Host next to it. The ordinary workflow is that I put the link of files (which have been upload in my Download Host) in my website. But how Can I authenticize my download links? so that a link is only valid for about 1 day and after that expires? Thanks Edited December 14, 2012 by Pikachu2000 Title corrected . . . Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/ Share on other sites More sharing options...
spyworld Posted December 13, 2012 Share Posted December 13, 2012 This is just an example of authenting download file. http://storage.imclement.com/share/001.zip Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/#findComment-1399140 Share on other sites More sharing options...
mostafatalebi Posted December 13, 2012 Author Share Posted December 13, 2012 I didn't get the point bro Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/#findComment-1399143 Share on other sites More sharing options...
mostafatalebi Posted December 13, 2012 Author Share Posted December 13, 2012 How Can I make a link available only to paid users, so the users outside the site don't access the file-download simply by copy-pasting a link into their url bar? Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/#findComment-1399163 Share on other sites More sharing options...
mrMarcus Posted December 13, 2012 Share Posted December 13, 2012 *authenticate (sorry, but that was driving me insane) This is a simple login system. Only privileged users can download files. 1. user registers and pays to become 'paid user' 2. paid user gets flagged in the db as a 'paid user' with a simple column in the `users` table such as `paid` (default=0 not paid, 1 = paid), or create a privilege system, which is a little more work, but has greater ability to scale. This can be a range of values: 0 = free user, 1 = registered user, 2 = paid user, 3 = god mode, etc. 3. build your download script to ensure the user is logged in: // download.php // quick pseudo code for logic session_start(); if ($_SESSION['auth']) { // user is logged in // check to ensure user has privileges to download this file (query or $_SESSION variable housing that value) // insert download code if user above check has passed } else { // user is not logged in // quit and redirect to appropriate page header('Location: /payment_page.php'); exit(0); } Just the jist of it. Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/#findComment-1399187 Share on other sites More sharing options...
mostafatalebi Posted December 14, 2012 Author Share Posted December 14, 2012 Oh! very simple solution, thank you a a lot man... Quote Link to comment https://forums.phpfreaks.com/topic/271951-authenticating-a-download-link/#findComment-1399296 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.