Jump to content

Not sure if this can be done. But want to try.


Mancent

Recommended Posts

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.mp4

now what I want to do is strip the name for later I want to find only this part of the file name

user_1
it will change for each user

user_2

and 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 just
get 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.mp4
and 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 by Mancent
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I have that already
this 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 streaming

and 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 Iphone
BUt works with Firefox PC Explorer PC and the Android devices Smart Tv
its strange. so I got tired of messing with it and just did a copy move temp file for each user

but 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 by Mancent
Link to comment
Share on other sites

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 by jazzman1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.