root/trunk/install/php/reservecomp.php

リビジョン 1, 4.7 kB (コミッタ: jplcom, コミット時期: 17 年 前)

initial import

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