Mancent Posted March 2, 2014 Share Posted March 2, 2014 (edited) ok this is tricky for me. but what isn't..Ok I copied a file from j drive and moved it to a tempfolder on the webroot.and it is named like this 'user_'.$uid.'_'.$at.'_'.$filename so it looks more like this. user_1_33c1a0d7a97493820ff4dadc42430841_5526d9ff57503f7aa219ed112413c5f0.mp4now what I want to do is strip the name for later I want to find only this part of the file name user_1it will change for each user user_2and when they login I once I get the php script to find that part of the filename. I want to delete all the files that are in the temp folder of that user if any is there. and also I want to delete the files when they are not login. or when they logout. and I would like to make a date timer also that lets the files stay in the temp folder for as long as they user is login, but if they are logout or inactive the files are removed also.. if(preg_match("/user_1/",$tempuserfile)) { I was thinking this might work but am not sure. } the reason why I am doing this is because I do not want users to be able to go to the webroot page and justget any file they want from http://192.168.0.8/filetemp/1.mp4 http://192.168.0.8/filetemp/2.mp4 http://192.168.0.8/filetemp/3.mp4and so on.. they would have to know the users ID and that's easy it counts from 1 to what ever but they also have to know the users accesstoken for $at and they would also have to know the filename md5 code to get the files for the user that is viewing that file.and if an when or once that user is no longer viewing that file it deletes it. so its only there a very sort time.these are the only files that are public and I want to make it as secure as I can. Edited March 2, 2014 by Mancent Quote Link to comment Share on other sites More sharing options...
trq Posted March 2, 2014 Share Posted March 2, 2014 A simpler approach would be to keep all your files outside of your web root, and then have a php script serve them up to your users based on whatever rules you like. There is a simple example of serving up a file (all be it, this one forces a download) here. Quote Link to comment Share on other sites More sharing options...
Mancent Posted March 2, 2014 Author Share Posted March 2, 2014 (edited) I have that alreadythis is my tests urls http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=sounds/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp3 http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=images/foldername&getfile=photo-thumb-98147.jpg images work just fine with no problems what so ever on all browsers and ipad android devices I have in the house. even on the smart tv web browser. and the mp3 work perfect also.. for streamingand force download works as well for all files. but when it comes to streaming the mp4 its always getting a broken play button on chrome PC, Ipad IphoneBUt works with Firefox PC Explorer PC and the Android devices Smart Tvits strange. so I got tired of messing with it and just did a copy move temp file for each userbut when it comes to mp4 it only works on some, so my solve was to move the file as a temp file in a temp folder on the webroot then read from there and it works on all devices again. Edited March 2, 2014 by Mancent Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 2, 2014 Share Posted March 2, 2014 (edited) I already told you in this thread, why that happens based on my experience. Try to change the relative path to absolute. &path=sounds/foldername/output //to something similar &path=C:/Apache/sounds/foldername/output/ Edited March 2, 2014 by jazzman1 Quote Link to comment 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.