10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?
$path = "./";
$seekat = $_GET["position"];
$filename = htmlspecialchars($_GET["file"]);
$ext=strrchr($filename, ".");
$file = $path . $filename;
if((file_exists($file)) && ($ext==".flv") && (strlen($filename)>2) && (!eregi(basename($_SERVER['PHP_SELF']), $filename)) && (ereg('^[^./][^/]*$', $filename)))
{
header("Content-Type: video/x-flv");
if($seekat != 0) {
print("FLV");
print(pack('C', 1 ));
print(pack('C', 1 ));
print(pack('N', 9 ));
print(pack('N', 9 ));
}
$fh = fopen($file, "rb");
fseek($fh, $seekat);
while (!feof($fh)) {
print (fread($fh, filesize($file)));
}
fclose($fh);
}
else
{
print("The file does not exist"); }
?>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!usr/bin/perl -w # get GET data if($ENV{'REQUEST_METHOD'} eq 'GET') { $Daten = $ENV{'QUERY_STRING'}; } else { $Daten = null; } # modify GET data array $Daten =~ s/%([\da-fA-f]{2})/pack("c",hex($1))/ge; $Daten =~ tr/+/ /; for(split/&/,$Daten) { ($key , $val) = split/=/,$_,2; $Form{$key} .= $val; } # full path to dir with video $path = "./"; # get position $seekat = $Form{'position'}; # get filename of video $filename = $Form{'file'}; $filename =~ s/\&/&/g; $filename =~ s/</</g; $filename =~ s/>/>/g; $filename =~ s/\"/"/g; # get filename ending $ext = substr($filename,length($filename)-4,4); # file is path + filename $file = $path . $filename; # if file exists do the pseudo streaming: if( (-e $file) && ($ext==".flv") && (length($filename)>2) && (!($filename =~ m/flvprovider.pl$/)) ) { print "Content-type: text/html\n\n"; if($seekat != 0) { print("FLV"); print(pack('C', 1 )); print(pack('C', 1 )); print(pack('N', 9 )); print(pack('N', 9 )); } # $fh = fopen($file, "rb"); open (FILE, $file) or die $!; binmode FILE; seek (FILE, $seekat, 0); while (!eof(FILE)) { read(FILE, $scalar, stat($file)); print $scalar; } close(FILE); } else { print "Content-type: text/html\n\n"; print "ERROR: The file does not exist"; }
perlpower+2007-09-17 10:26:32--
Mein Perl-Versuch:
Code (perl): (dl )1 2 3 4 5 6 7 8 9 10 11 12 13 14 15#!usr/bin/perl -w # get GET data if($ENV{'REQUEST_METHOD'} eq 'GET') { $Daten = $ENV{'QUERY_STRING'}; } else { $Daten = null; } # modify GET data array $Daten =~ s/%([\da-fA-f]{2})/pack("c",hex($1))/ge; $Daten =~ tr/+/ /; for(split/&/,$Daten) { ($key , $val) = split/=/,$_,2; $Form{$key} .= $val; }
1 2 3 4 5 6 7 8
#!/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; my %Form = $cgi->Vars;
QuoteCode (perl): (dl )1 2 3 4 5# full path to dir with video # ... # get filename ending $ext = substr($filename,length($filename)-4,4);
QuoteCode (perl): (dl )1 2 3 4 5# file is path + filename $file = $path . $filename; # if file exists do the pseudo streaming: if( (-e $file) && ($ext==".flv") && (length($filename)>2) && (!($filename =~ m/flvprovider.pl$/)) )
1
2
3
4
5
6
my $len = 1024;
while (!eof(FILE)) {
my $scalar;
read(FILE, $scalar, $len);
print $scalar;
}
10 Einträge, 1 Seite |