| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
?> |
|---|
| 23 |
|
|---|
| 24 |
<?php |
|---|
| 25 |
include("./foltialib.php"); |
|---|
| 26 |
|
|---|
| 27 |
$con = m_connect(); |
|---|
| 28 |
$now = date("YmdHi"); |
|---|
| 29 |
$errflag = 0; |
|---|
| 30 |
$pname = "手動録画"; |
|---|
| 31 |
|
|---|
| 32 |
function printtitle(){ |
|---|
| 33 |
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"> |
|---|
| 34 |
<html lang=\"ja\"> |
|---|
| 35 |
<head> |
|---|
| 36 |
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-JP\"> |
|---|
| 37 |
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"> |
|---|
| 38 |
<link rel=\"stylesheet\" type=\"text/css\" href=\"graytable.css\"> "; |
|---|
| 39 |
|
|---|
| 40 |
print "<title>foltia:番組手動予約</title> |
|---|
| 41 |
</head>"; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
printtitle(); |
|---|
| 45 |
?> |
|---|
| 46 |
<body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > |
|---|
| 47 |
<div align="center"> |
|---|
| 48 |
<?php |
|---|
| 49 |
printhtmlpageheader(); |
|---|
| 50 |
?> |
|---|
| 51 |
</div> |
|---|
| 52 |
<p align="left"><font color="#494949" size="6"> |
|---|
| 53 |
番組手動予約 |
|---|
| 54 |
</font></p> |
|---|
| 55 |
<hr size="4"> |
|---|
| 56 |
<?php |
|---|
| 57 |
|
|---|
| 58 |
$startdate = getgetnumform(startdate); |
|---|
| 59 |
$starttime = getgetnumform(starttime); |
|---|
| 60 |
|
|---|
| 61 |
if (($startdate == "") || ($starttime == "")){ |
|---|
| 62 |
print "<p align=\"left\">全項目手動指定で予約します。</p>\n"; |
|---|
| 63 |
}else{ |
|---|
| 64 |
|
|---|
| 65 |
$lengthmin = getgetnumform(lengthmin); |
|---|
| 66 |
$recstid = getgetnumform(recstid); |
|---|
| 67 |
$pname = getgetform(pname); |
|---|
| 68 |
|
|---|
| 69 |
$startdatetime = "$startdate"."$starttime"; |
|---|
| 70 |
if (foldatevalidation($startdatetime)){ |
|---|
| 71 |
|
|---|
| 72 |
}else{ |
|---|
| 73 |
$errflag = 1; |
|---|
| 74 |
$errmsg = "日付が不正です。"; |
|---|
| 75 |
} |
|---|
| 76 |
if ($lengthmin < 361){ |
|---|
| 77 |
|
|---|
| 78 |
}else{ |
|---|
| 79 |
$errflag = 2; |
|---|
| 80 |
$errmsg = "録画時間は360分で区切ってください。"; |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
if ($recstid != ""){ |
|---|
| 84 |
$query = " |
|---|
| 85 |
SELECT stationname |
|---|
| 86 |
FROM foltia_station |
|---|
| 87 |
WHERE stationid = $recstid"; |
|---|
| 88 |
$stationvalid = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 89 |
$stationcount = pg_num_rows($stationvalid); |
|---|
| 90 |
|
|---|
| 91 |
if ($stationcount == 1){ |
|---|
| 92 |
$recstationname = pg_fetch_row($stationvalid, 0); |
|---|
| 93 |
|
|---|
| 94 |
}else{ |
|---|
| 95 |
$errflag = 3; |
|---|
| 96 |
$errmsg = "放送局設定が異常です。"; |
|---|
| 97 |
} |
|---|
| 98 |
} |
|---|
| 99 |
|
|---|
| 100 |
if ($errflag == 0){ |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
$enddatetime = calcendtime($startdatetime,$lengthmin); |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
if (($startdatetime > $now ) && ($enddatetime > $now ) && ($enddatetime > $startdatetime ) ){ |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
$query = "SELECT min(pid) FROM foltia_subtitle "; |
|---|
| 112 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 113 |
$maxrows = pg_num_rows($rs); |
|---|
| 114 |
if ($maxrows == 0){ |
|---|
| 115 |
$insertpid = -1 ; |
|---|
| 116 |
}else{ |
|---|
| 117 |
$rowdata = pg_fetch_row($rs, 0); |
|---|
| 118 |
$insertpid = $rowdata[0]; |
|---|
| 119 |
$insertpid-- ; |
|---|
| 120 |
} |
|---|
| 121 |
|
|---|
| 122 |
$query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; |
|---|
| 123 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 124 |
$maxrows = pg_num_rows($rs); |
|---|
| 125 |
if ($maxrows == 0){ |
|---|
| 126 |
$nextcno = 1 ; |
|---|
| 127 |
}else{ |
|---|
| 128 |
$rowdata = pg_fetch_row($rs, 0); |
|---|
| 129 |
$nextcno = $rowdata[0]; |
|---|
| 130 |
$nextcno++ ; |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
if ($demomode){ |
|---|
| 135 |
}else{ |
|---|
| 136 |
|
|---|
| 137 |
$query = " |
|---|
| 138 |
insert into foltia_subtitle |
|---|
| 139 |
values ( '$insertpid','0','$recstid', |
|---|
| 140 |
'$nextcno','$pname','$startdatetime','$enddatetime','0' ,'$lengthmin')"; |
|---|
| 141 |
|
|---|
| 142 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
$oserr = system("$toolpath/perl/addatq.pl 0 0"); |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
print "下記予約を完了いたしました。<br>"; |
|---|
| 154 |
|
|---|
| 155 |
print "録画開始:"; |
|---|
| 156 |
echo foldate2print($startdatetime); |
|---|
| 157 |
print "<br /> |
|---|
| 158 |
録画終了:"; |
|---|
| 159 |
echo foldate2print($enddatetime); |
|---|
| 160 |
print "<br /> |
|---|
| 161 |
録画尺: $lengthmin 分<br /> |
|---|
| 162 |
録画局:$recstationname[0]<br /> |
|---|
| 163 |
番組名:$pname<br /> |
|---|
| 164 |
"; |
|---|
| 165 |
exit(); |
|---|
| 166 |
}else{ |
|---|
| 167 |
print "時刻が不正なために予約できませんでした。 <br>"; |
|---|
| 168 |
|
|---|
| 169 |
} |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
}else{ |
|---|
| 173 |
print "入力項目が正しくなさそうです。$errmsg<br />\n"; |
|---|
| 174 |
} |
|---|
| 175 |
|
|---|
| 176 |
} |
|---|
| 177 |
?> |
|---|
| 178 |
<form id="record" name="record" method="get" action="./m.php"> |
|---|
| 179 |
<p>放送日: |
|---|
| 180 |
<input name="startdate" type="text" id="startdate" size="9" value="<?=$startdate?>" /> |
|---|
| 181 |
年月日 Ex.19800121</p> |
|---|
| 182 |
<p>録画開始時刻: |
|---|
| 183 |
<input name="starttime" type="text" id="starttime" size="5" value="<?=$starttime?>" /> |
|---|
| 184 |
時分 Ex.2304 </p> |
|---|
| 185 |
<p> |
|---|
| 186 |
録画尺: |
|---|
| 187 |
<input name="lengthmin" type="text" id="lengthmin" size="4" value="<?=$lengthmin?>"/> |
|---|
| 188 |
分 (最長360分) </p> |
|---|
| 189 |
<p>録画局: |
|---|
| 190 |
<?php |
|---|
| 191 |
$query = " |
|---|
| 192 |
SELECT stationid,stationname,stationrecch |
|---|
| 193 |
FROM foltia_station |
|---|
| 194 |
WHERE stationrecch > 0 |
|---|
| 195 |
ORDER BY \"stationid\" ASC"; |
|---|
| 196 |
|
|---|
| 197 |
$stations = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 198 |
$stationcount = pg_num_rows($stations); |
|---|
| 199 |
|
|---|
| 200 |
if ($stationcount > 0 ){ |
|---|
| 201 |
for ($row = 0; $row < $stationcount ; $row++) { |
|---|
| 202 |
$rowdata = pg_fetch_row($stations, $row); |
|---|
| 203 |
if ($recstid == $rowdata[0]){ |
|---|
| 204 |
print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] ($rowdata[2]ch) \n"; |
|---|
| 205 |
}else{ |
|---|
| 206 |
print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" /> $rowdata[1] ($rowdata[2]ch) \n"; |
|---|
| 207 |
} |
|---|
| 208 |
} |
|---|
| 209 |
}else{ |
|---|
| 210 |
print "放送局データベースが正しくセットアップされていません。録画可能局がありません"; |
|---|
| 211 |
} |
|---|
| 212 |
|
|---|
| 213 |
$query = " |
|---|
| 214 |
SELECT stationid,stationname,stationrecch |
|---|
| 215 |
FROM foltia_station |
|---|
| 216 |
WHERE stationrecch > -2 AND stationrecch < 1 |
|---|
| 217 |
ORDER BY \"stationid\" ASC"; |
|---|
| 218 |
|
|---|
| 219 |
$stations = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 220 |
$stationcount = pg_num_rows($stations); |
|---|
| 221 |
|
|---|
| 222 |
if ($stationcount > 0 ){ |
|---|
| 223 |
for ($row = 0; $row < $stationcount ; $row++) { |
|---|
| 224 |
$rowdata = pg_fetch_row($stations, $row); |
|---|
| 225 |
if ($rowdata[0] != 0){ |
|---|
| 226 |
if ($recstid == $rowdata[0]){ |
|---|
| 227 |
print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] \n"; |
|---|
| 228 |
}else{ |
|---|
| 229 |
print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" /> $rowdata[1] \n"; |
|---|
| 230 |
} |
|---|
| 231 |
|
|---|
| 232 |
} |
|---|
| 233 |
} |
|---|
| 234 |
} |
|---|
| 235 |
|
|---|
| 236 |
?> |
|---|
| 237 |
<p>番組名: |
|---|
| 238 |
<input name="pname" type="text" id="pname" value="<?=$pname ?>" /> |
|---|
| 239 |
</p> |
|---|
| 240 |
<input type="submit" value="予約"> |
|---|
| 241 |
</form> |
|---|
| 242 |
|
|---|
| 243 |
</body> |
|---|
| 244 |
</html> |
|---|
| 245 |
|
|---|