Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Neinstar Filmz Video Handler 0-00 by Nick
- The main purpose of this script is to throttle bandwidth,
- count impressions and validate voucher codes by bottlenecking
- video access.
- Voucher codes come in the form of an account, a clip id and
- a redemption code. If any specific code is in an invalid
- format it is intended to swap in a default in its place.
- After the validation step has completed, the script is then
- to stream the requested video-on-demand.
- */
- $ini['acct']=$_GET['acct'];
- $acct=preg_match('/(\d10})/',$ini['acct']);
- if(is_array($acct))
- $ini['acct']=$acct;
- else
- $ini['acct']='0000000000';
- $ini['clip']=$_GET['clip'];
- $clip=preg_match('/(\d{8}[0-9X][0-9X][0-9X][0-9X][0-9X][0-9X][+-]\d{4})/',$ini['clip']);
- if(is_array($clip))
- $ini['clip']=$clip;
- else
- $ini['clip']='20100917022551-0700';
- $ini['code']=$_GET['code'];
- $code=preg_match('/([0-9a-f][0-9a-f][0-9a-f]-[0-9a-f][0-9a-f][0-9a-f][0-9a-f])/',$ini['code']);
- if(is_array($code))
- $ini['code']=$code;
- else
- $ini['code']='000-0000';
- $ini['buff']=intval($_GET['buff']);
- if($ini['buff']<14400)
- $ini['buff']=14400;
- if($ini['buff']>2<<10)
- $ini['buff']=2<<10;
- $fn='./clips/'.$ini['clip'].'.mp4';
- if($ini['acct']==='0000000000') {
- if(!is_file($fn)) {
- header($_SERVER["SERVER PROTOCOL"].' 404 Not Found');
- header('Content-Typ: video/mpeg');
- header('Cache-Control: no-cache, must-revalidate');
- header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
- }
- elseif($ini['code']==='000-0000') {
- $fh=fopen($fn,'r');
- $sz=filesize($fn);
- $buf='';
- header($_SERVER["SERVER PROTOCOL"].' 200 OK');
- header('Content-Type: video/mpeg');
- header('Content-Disposition: inline; filename="'.$ini['clip'].'.mp4"');
- header('Content-Length: '.$sz);
- header('Cache-Control: no-cache, must-revalidate');
- header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
- ob_start();
- while(!feof($fh)) {
- $length=($sz-ftell($fh));
- if($length>=2<<10);
- $buf.=fread($fh,2<<10);
- else
- $buf.=fread($fh,$length);
- if((feof($fh)&&(strlen($buf)>0))||(strlen($buf>=$buffsz)) {
- echo $buf;
- $buf='';
- ob_end_flush();
- ob_start();
- }
- }
- ob_end_flush();
- fclose($fh);
- }
- else {
- header($_SERVER["SERVER PROTOCOL"].' 503 Forbidden');
- echo '503 Forbidden';
- }
- }
- else {
- header($_SERVER["SERVER PROTOCOL"].' 503 Forbidden');
- echo '503 Forbidden';
- }
- /*
- echo '<html><body><table border="0px" cellpadding="0px" cellspacing="0px"><tr><td bgcolor="black" width="427px" height="240px" align="middle"><video src="'.$ini['clip'].'.mp4" autoplay="1" controls="" height="240px"></video></td></tr><tr><td align="left" style="font {variation: small-caps; size: +2;}">'.$ini['clip'].'</td></tr></table></body></html>';
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement