php禁止下载视频播放器,是否可以防止从网站下载视频

//test.php

if (session_id() == '') {

session_start();

}

error_reporting(0);

$out2 = ob_get_contents();

if (strpos($out2, "

ob_clean();

if (strpos($out2, "

$window = md5(time());

$_SESSION['window'] = $window;

?>

jQuery.ajax({

type: "POST",

url: "/enable.php",

});

if (strpos($out2, "

$_SESSION['safe'] = "SAFE";

}

function getURL($matches) {

global $rootURL;

if ($_SESSION['defat'] == "") {

$_SESSION['defat'] = 1;

} else {

$_SESSION['defat'] = $_SESSION['defat'] + 1;

}

$_SESSION['x' . $matches['2'] . $_SESSION['defat']] = 0;

$_SESSION['defa' . $matches['2'] . $_SESSION['defat']] = md5(time() . "Defa Protector");

$_SESSION['imdefa' . $_SESSION['defat']] = md5('Defa') . base64_encode(base64_encode($matches['2']));

$_SESSION['x' . $matches['2']] = 0;

$_SESSION['defa' . $matches['2']] = md5(time() . "Defa Protector");

$_SESSION['file' . $_SESSION['defat']] = md5('Defa') . base64_encode(base64_encode($matches['2']));

return $matches[1] . $rootURL . "defavid.php?window=" . $_SESSION['window'] . "&defat=" . $_SESSION['defat'];

}

$mes = preg_replace_callback("/(]*src *= *[\"']?)([^\"']*)/i", getURL, $out2);

$mes = preg_replace_callback("/(]*src *= *[\"']?)([^\"']*)/i", getURL, $mes);

$mes = preg_replace_callback("/(]*src *= *[\"']?)([^\"']*)/i", getURL, $mes);

echo $mes;

} else {

echo $out2;

}

}

?>

//defavid.php

ob_start();

if (session_id() == '') {

session_start();

}

$window = addslashes(strip_tags($_GET['window']));

$md5defa = md5('Defa');

$t = (int) $_GET['defat'];

$filedefa = str_replace($md5defa, '', $_SESSION['file' . $t]);

$file = str_replace("https://", "http://", base64_decode(base64_decode($filedefa)));

$defa = str_replace("https://", "http://", base64_decode(base64_decode($filedefa)));

$defaurl = get_headers($file, 1);

$url = $defaurl["Location"];

if ($url != $file && $url != "") {

$file = $url;

}

if (!function_exists('http_response_code')) {

function http_response_code($newcode = NULL) {

static $code = 200;

if ($newcode !== NULL) {

header('X-PHP-Response-Code: ' . $newcode, true, $newcode);

if (!headers_sent())

$code = $newcode;

}

return $code;

}

}

$header = http_response_code();

$header2 = getallheaders();

function isMobile() {

return preg_match("/(MSIE|Edge|android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);

}

if (isset($_SESSION['jsenable' . $window])) {

if ($header == 200 && $header2['Accept'] != "" && $_SESSION['x' . $defa . $t] == 0 && isMobile() || isset($_SERVER['HTTP_RANGE'])) {

$_SESSION['x' . $defa . $t] = $_SESSION['x' . $defa . $t] + 1;

if (isset($_SERVER['HTTP_RANGE'])) {

$opts['http']['header'] = "Range: " . $_SERVER['HTTP_RANGE'];

}

$opts['http']['method'] = "HEAD";

$conh = stream_context_create($opts);

$opts['http']['method'] = "GET";

$cong = stream_context_create($opts);

$out[] = file_get_contents($file, false, $conh);

$out[] = $http_response_header;

ob_end_clean();

array_map("header", $http_response_header);

readfile($file, false, $cong);

die();

}

}

?>

//enable.php

if(session_id() == ''){

session_start();

}

$window = $_SESSION['window'];

$_SESSION['jsenable'.$window] = TRUE;

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值