root/trunk/install/php/reservecomp.php

リビジョン 83, 5.1 kB (コミッタ: sorshi, コミット時期: 15 年 前)

foltiaHD最初のリリース。
デジタル録画はFriio/Friio BS/CSのみに対応。
ivtvは1.0系使用になりました。

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 reserveprogram.php
7
8 目的
9 番組の予約登録をします。
10
11 引数
12 tid:タイトルID
13 station:録画局
14 bitrate:録画ビットレート(単位:Mbps)
15
16  DCC-JPL Japan/foltia project
17
18 */
19
20 include("./foltialib.php");
21 $con = m_connect();
22
23 if ($useenvironmentpolicy == 1){
24 if (!isset($_SERVER['PHP_AUTH_USER'])) {
25     header("WWW-Authenticate: Basic realm=\"foltia\"");
26     header("HTTP/1.0 401 Unauthorized");
27     redirectlogin();
28     exit;
29 } else {
30 login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);
31 }
32 }//end if login
33
34 ?>
35 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
36 <html lang="ja">
37 <head>
38 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
39 <meta http-equiv="Content-Style-Type" content="text/css">
40 <link rel="stylesheet" type="text/css" href="graytable.css">
41 <title>foltia</title>
42 </head>
43
44 <?php
45
46
47 $tid = getgetnumform(tid);
48         if ($tid == "") {
49         die_exit("番組が指定されていません<BR>");
50         }
51
52 $station = getgetnumform(station);
53         if ($station == "") {
54         $station = 0;
55         }
56 $usedigital = getgetnumform(usedigital);
57         if ($usedigital == "") {
58         $usedigital = 0;
59         }
60 $bitrate = getgetnumform(bitrate);
61         if ($bitrate == "") {
62         $bitrate = 5;
63         }
64
65
66 $now = date("YmdHi");   
67
68 //タイトル取得
69     $query = "select title from foltia_program where tid='$tid'";
70     $rs = m_query($con, $query, "DBクエリに失敗しました");
71     $maxrows = pg_num_rows($rs);
72             
73         if ($maxrows == 0) {
74         $title = "(未登録)";
75         }else{
76         $rowdata = pg_fetch_row($rs, 0);
77         $title = htmlspecialchars($rowdata[0]);
78         }
79
80 ?>
81 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
82
83 <?php
84     printhtmlpageheader();
85 ?>
86   <p align="left"><font color="#494949" size="6">予約完了</font></p>
87   <hr size="4">
88
89 <?=$title?>」を番組予約モードで予約しました。 <br>
90  <br>
91 予約スケジュール <BR>
92
93 <?php
94
95 if ($station != 0){
96 //局限定
97     $query = "
98 SELECT
99 foltia_subtitle.pid , 
100 stationname,
101 foltia_subtitle.countno,
102 foltia_subtitle.subtitle,
103 foltia_subtitle.startdatetime ,
104 foltia_subtitle.lengthmin ,
105 foltia_subtitle.startoffset
106 FROM foltia_subtitle , foltia_program ,foltia_station 
107 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
108  AND foltia_station.stationid = $station
109  AND foltia_subtitle.startdatetime >=  '$now'  AND foltia_program.tid ='$tid'
110 ORDER BY foltia_subtitle.startdatetime  ASC
111 ";
112
113 }else{
114 //全局
115     $query = "
116 SELECT
117 foltia_subtitle.pid , 
118 stationname,
119 foltia_subtitle.countno,
120 foltia_subtitle.subtitle,
121 foltia_subtitle.startdatetime ,
122 foltia_subtitle.lengthmin ,
123 foltia_subtitle.startoffset
124 FROM foltia_subtitle , foltia_program ,foltia_station 
125 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
126  AND foltia_subtitle.startdatetime >=  '$now'  AND foltia_program.tid ='$tid'
127 ORDER BY foltia_subtitle.startdatetime  ASC
128 ";
129
130 }
131     $rs = m_query($con, $query, "DBクエリに失敗しました");
132     $maxrows = pg_num_rows($rs);
133             
134         if ($maxrows == 0) {
135         echo("放映予定はいまのところありません<BR>");
136         }
137         else{
138         $maxcols = pg_num_fields($rs);       
139 ?>
140   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be">
141     <thead>
142         <tr>
143             <th align="left">PID</th>
144             <th align="left">放映局</th>
145             <th align="left">話数</th>
146             <th align="left">サブタイトル</th>
147             <th align="left">開始時刻</th>
148             <th align="left">総尺</th>
149             <th align="left">時刻ずれ</th>
150
151         </tr>
152     </thead>
153
154     <tbody>
155         <?php
156             /* テーブルのデータを出力 */
157             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
158                 echo("<tr>\n");
159                 /* pg_fetch_row で一行取り出す */
160                 $rowdata = pg_fetch_row($rs, $row);
161
162                 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */
163                     echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n");
164                 }
165                 echo("</tr>\n");
166             }
167         }//end if
168         ?>
169     </tbody>
170 </table>
171
172
173 <?php
174 if ($demomode){
175 }else{
176 //foltia_tvrecord 書き込み
177 //既存が予約あって、新着が全局予約だったら
178 if ($station ==0){
179     $query = "
180 SELECT
181  *
182 FROM foltia_tvrecord 
183 WHERE tid = '$tid'
184 ";
185     $rs = m_query($con, $query, "DBクエリに失敗しました");
186     $maxrows = pg_num_rows($rs);
187     if ($maxrows > 0){
188     //既存局を消す
189         $query = "DELETE
190 FROM foltia_tvrecord 
191 WHERE tid = '$tid'
192 ";
193     $rs = m_query($con, $query, "DBクエリに失敗しました");
194         }
195 }//endif
196
197     $query = "
198 SELECT
199  *
200 FROM foltia_tvrecord 
201 WHERE tid = '$tid'  AND stationid = '$station'
202 ";
203     $rs = m_query($con, $query, "DBクエリに失敗しました");
204     $maxrows = pg_num_rows($rs);
205
206         if ($maxrows == 0) { //新規追加
207                 $query = "INSERT INTO  foltia_tvrecord  values ('$tid','$station','$bitrate','$usedigital')";
208                 $rs = m_query($con, $query, "DB書き込みに失敗しました");
209         }else{//修正 (ビットレート)
210             $query = "UPDATE  foltia_tvrecord  SET
211   bitrate = '$bitrate' , digital = '$usedigital'  WHERE tid = '$tid'  AND stationid = '$station' ";
212             $rs = m_query($con, $query, "DB書き込みに失敗しました");
213         }
214     
215 //キュー入れプログラムをキック
216 //引数 TID チャンネルID
217 //echo("$toolpath/perl/addatq.pl $tid $station");
218 $oserr = system("$toolpath/perl/addatq.pl $tid $station");
219 }//end if demomode
220 ?>
221
222
223 </body>
224 </html>
225
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed