This file takes password
input.
<html>
<form action="playvideo.php" method="post">
<input type="text" name="password"/>
<input type="submit">
</html>
This file plays the video
<?php
if(isset($_POST["password"])){
$password=$_POST["password"];
}
else{
$password="";
}
if($password!="pass"){
echo "unauthorised";
}
else{
$local_file = 'video.mp4';
$size = filesize($local_file);
header("Content-Type: video/mp4");
header("Content-Length: ".$size);
readfile($local_file);
}
?>
Also the code works fine if I do not wrap it inside an if
statement.