PHP - Dynamic URL -


i have link live video stream.

http://xxx.xxx.xxx.xxx:xxx/live/stream.m3u8

i need make dynamic link changes can hide / secure ip users of web page.

i see suggestions making hash out of secret word , users ip this:

    $token = somehash($ip_address . $timestamp . $secret); $url = 'http://site/' . $token . '/' . $timestamp . '/filename'; 

my question is... how link work?

you end link not point resource.

http://mysite.com/hash-code/time-stamp/filename 

that link wont work because not valid url.

any tips?

thanks

understand this, need considerably complex logic routing part. might advisable implement php framework handle custom routing you, such fuelphp or laravel 4.

in laravel 4, example, define route this:

route::get('streams/{token}', 'streamcontroller@showstream'); 

then define controller app/controllers/streamcontroller.php action this:

[..]    class streamcontroller extends basecontroller { [..]  public function showstream($token) {     $ip = request::server('remote_addr');     $url = request::url();      // hashing on user's ip , $token (and maybe timestamp)     // compare $url user tried view - not going write code :)      if($allowed) {         return view::make('your.defined.view.with.stream');     } else {         return redirect::to('/');     }              [..] } 

this rough example, actual code take more effort. i'm merely trying point in right direction. , i'd keep answer reasonably short. goal can of course achieved in million different ways, gazillion different frameworks, how approach laravel 4.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -