yami007 Posted January 10, 2010 Share Posted January 10, 2010 well what i am trying to do is preventing the user from downloading the same file twice or when they cancel the download. Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/ Share on other sites More sharing options...
corrupshun Posted January 10, 2010 Share Posted January 10, 2010 well what i am trying to do is preventing the user from downloading the same file twice or when they cancel the download. You could make it so it records the ip address while it is interacting with your file and when the connection is destroyed disable rights to the file for that ip address. Which I don't know how to actually put in php.. sorry i'm a failure! Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992382 Share on other sites More sharing options...
mmarif4u Posted January 10, 2010 Share Posted January 10, 2010 There are many ways to do it, two i will mention here: 1-Password protected pages, user can login to the system and download the file..save the entry into a table for that user and next time check if that user already downloaded the file. 2- If not password protected pages, then you can use/save IP. But they can download from another location or restart router/modem in case of dynamic IP from their ISP. Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992384 Share on other sites More sharing options...
yami007 Posted January 10, 2010 Author Share Posted January 10, 2010 Thanks For You : corrupshun And mmarif4u But I Don't Mean This I Mean I Want To Know If User Download The File Or Cancel It, And I Delete This File (The File Is Temporary). I hope that I have brought you the idea Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992388 Share on other sites More sharing options...
teamatomic Posted January 10, 2010 Share Posted January 10, 2010 How is the user getting the file. From a FTP client? From a php script? If from a script then when the download is complete then just delete the file. ...FTP stuff...(see the php manual) $result = ftp_fget($connect $local,"$dl_file", FTP_BINARY); if (!$result) { echo "download failed!"; } else { unlink("$dl_file"); } As for a canceled DL. Only if you have a cancel button. Otherwise you have no way of positively knowing. One other problem is that not all transfers, even when completed, result in a viable file. Files can be corrupted enroute. If its a text or graphic it may not be much of a problem but if its an executable then you will have an issue. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992397 Share on other sites More sharing options...
yami007 Posted January 10, 2010 Author Share Posted January 10, 2010 This Is Not What I Mean I Have PHP Upload Script And Want To Do Like Rapidshare Or Zshare Download When The User Or The Guest Download The File I Have To Delete It Because The File Is Temporary. Will Now I Want To Know How To Check If The User Or The Guest Is Close The Connection With The Download File Not With The Page . Thanks In Advance Man. Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992399 Share on other sites More sharing options...
yami007 Posted January 11, 2010 Author Share Posted January 11, 2010 Please Help Me Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992691 Share on other sites More sharing options...
trq Posted January 11, 2010 Share Posted January 11, 2010 You would need to store your files in a location outside of your web root. You would then need to use a force download script (such as the one within the Faq/Code Snippet board, though you would need to customize it to keep track of what files a user has downloaded (by recording it within a database). Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992704 Share on other sites More sharing options...
yami007 Posted January 11, 2010 Author Share Posted January 11, 2010 Ok Thank You But When I Can Give a Force Download Script Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992731 Share on other sites More sharing options...
yami007 Posted January 11, 2010 Author Share Posted January 11, 2010 Oh Yeah Thank You I Find It In The Forum You'll give Me Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992734 Share on other sites More sharing options...
MadTechie Posted January 11, 2010 Share Posted January 11, 2010 But When I Can Give a Force Download Script Huh!.. You use a force download script so the downloads are controlled by a PHP script, after the readfile function has been used you can simply unlink the file, if the script fails to complete the readfile() the the unlink will not be used thus the file remains, if the readfile() is complete then the unlink will be used thus removing the file! PS your initial caps button seams to be stuck! Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992737 Share on other sites More sharing options...
ignace Posted January 11, 2010 Share Posted January 11, 2010 I already gave this link once somewhere in another post http://onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992880 Share on other sites More sharing options...
MadTechie Posted January 11, 2010 Share Posted January 11, 2010 I already gave this link once somewhere in another post http://onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html Nah!, that was to tomhoad, (Unique MP3 download link that links to a previous post (How do you provide a unique url that expires or prevent a user from accessing) LOL) worth a read Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-992924 Share on other sites More sharing options...
ignace Posted January 11, 2010 Share Posted January 11, 2010 Well yeah it was that post I was referring to but didn't knew the title nor poster. Thx MadTechie Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-993076 Share on other sites More sharing options...
MadTechie Posted January 11, 2010 Share Posted January 11, 2010 Welcome, Love the upgrade vista to Linux quote, Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-993078 Share on other sites More sharing options...
yami007 Posted January 13, 2010 Author Share Posted January 13, 2010 Thanks For All Freaks.... Quote Link to comment https://forums.phpfreaks.com/topic/187961-any-idea-how-i-could-do-this/#findComment-994344 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.