root/trunk/install/php/reservecomp.php

リビジョン 70, 4.9 kB (コミッタ: sorshi, コミット時期: 16 年 前)

環境ポリシー機能搭載

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