-
Notifications
You must be signed in to change notification settings - Fork 0
/
bgsound.cgi
executable file
·70 lines (53 loc) · 1.17 KB
/
bgsound.cgi
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
65
66
67
68
69
#!/usr/bin/perl -T
#for sysopen()
use Fcntl;
# 設定ファイル読み込み
if ( -f "./moe_bbs_cnf.pl" ){
require './moe_bbs_cnf.pl';
}else{
require './moe_bbs_cnf.pl.md';
}
if($ENV{'QUERY_STRING'}){
($name, $value) = split(/=/,$ENV{'QUERY_STRING'});
$bgm = $value;
}else{
if($bgm_play){
#open(IN,"$logfile");
sysopen(IN,"$logfile",O_RDONLY);
@lines = <IN>;
close(IN);
shift(@lines);
foreach $line (@lines) {
local($num,$k,$dt,$na,$em,$sub,$com,
$url,$host,$pw,$color,$icon,$b,$up_on,$img) = split(/<>/, $line);
if($img =~ /bgm$/){
$img =~ s/bgm$//;
if($img =~ /\.$/){
$img="$img"."bgm";
}
$bgm=$img;
}elsif($img =~ /cgm$/){
$img =~ s/\.([^.]+)\.([^.]*)cgm$//;
$bgm = "$img.$2";
if($bgm =~ /\.$/){$bgm="$bgm"."bgm";}
}
if($bgm){last;}
}
}
}
if($ENV{'HTTP_USER_AGENT'} =~ /MSIE/){
$bgm_ex="<bgsound src=\"$bgm\" loop=infinite>";
}else{
$bgm_ex="<EMBED SRC=\"$bgm\" WIDTH=150 HEIGHT=40 AUTOSTART=true REPEAT=true LOOP=true PANEL=0>";
}
print "Content-type: text/html\n\n";
print <<EOM;
<!doctype html>
<html>
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8">
</head>
<body>
$bgm_ex
</body></html>
EOM