チェンジセット 94: trunk/install/php/m.php

差分発生行の前後
無視リスト:
コミット日時:
2010/02/28 22:28:26 (14 年前)
コミッタ:
sorshi
ログメッセージ:

SQLite採用

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • trunk/install/php/m.php

    r83 r94  
    9797SELECT stationname   
    9898FROM foltia_station  
    99 WHERE stationid = $recstid"; 
    100         $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); 
    101         $stationcount = pg_num_rows($stationvalid); 
    102  
    103         if ($stationcount == 1){ 
    104                 $recstationname = pg_fetch_row($stationvalid, 0); 
    105         //valid 
    106         }else{ 
     99WHERE stationid = ? "; 
     100//      $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); 
     101        $stationvalid = sql_query($con, $query, "DBクエリに失敗しました",array($recstid)); 
     102                $recstationname = $stationvalid->fetch(); 
     103                if (! $recstationname) { 
    107104                $errflag = 3; 
    108105                $errmsg = "放送局設定が異常です。"; 
     
    128125//min pidを探す 
    129126$query = "SELECT min(pid) FROM  foltia_subtitle "; 
    130         $rs = m_query($con, $query, "DBクエリに失敗しました"); 
    131         $maxrows = pg_num_rows($rs); 
    132         if ($maxrows == 0){ 
    133         $insertpid = -1 ; 
     127//      $rs = m_query($con, $query, "DBクエリに失敗しました"); 
     128        $rs = sql_query($con, $query, "DBクエリに失敗しました"); 
     129        $rowdata = $rs->fetch(); 
     130        if (! $rowdata) { 
     131                $insertpid = -1 ; 
    134132        }else{ 
    135         $rowdata = pg_fetch_row($rs, 0); 
    136         $insertpid = $rowdata[0]; 
    137         $insertpid-- ; 
     133                if ($rowdata[0] > 0) { 
     134                        $insertpid = -1 ; 
     135                }else{ 
     136                        $insertpid = $rowdata[0]; 
     137                        $insertpid-- ; 
     138                } 
    138139        } 
    139140// next 話数を探す 
    140141$query = "SELECT max(countno) FROM  foltia_subtitle WHERE tid = 0"; 
    141         $rs = m_query($con, $query, "DBクエリに失敗しました"); 
    142         $maxrows = pg_num_rows($rs); 
    143         if ($maxrows == 0){ 
     142//      $rs = m_query($con, $query, "DBクエリに失敗しました"); 
     143        $rs = sql_query($con, $query, "DBクエリに失敗しました"); 
     144                        $rowdata = $rs->fetch(); 
     145                        if (! $rowdata) { 
    144146        $nextcno = 1 ; 
    145147        }else{ 
    146         $rowdata = pg_fetch_row($rs, 0); 
    147148        $nextcno = $rowdata[0]; 
    148149        $nextcno++ ; 
     
    159160        insert into foltia_subtitle  (pid ,tid ,stationid , countno ,subtitle , 
    160161startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby )   
    161         values ( '$insertpid','0','$recstid', 
    162                 '$nextcno','$pname','$startdatetime','$enddatetime','0' ,'$lengthmin', '$memberid')"; 
     162        values ( ?,'0',?,?,?,?,?,'0',?,?)"; 
    163163         
    164                 $rs = m_query($con, $query, "DBクエリに失敗しました"); 
     164//              $rs = m_query($con, $query, "DBクエリに失敗しました"); 
     165//print "【DEBUG】$insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid <br>\n"; 
     166                $rs = sql_query($con, $query, "DBクエリに失敗しました",array($insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid)); 
    165167         
    166168        //addatq.pl 
     
    168170        //引数 TID チャンネルID 
    169171        //echo("$toolpath/perl/addatq.pl $tid $station"); 
    170          
    171                 $oserr = system("$toolpath/perl/addatq.pl 0 0"); 
     172        exec("$toolpath/perl/addatq.pl 0 0"); 
     173        $oserr = system("$toolpath/perl/addatq.pl 0 0"); 
     174        //--------------------------------------------------- 
     175                        if ($oserr){ 
     176                        print "[DEBUG]$oserr 「$toolpath/perl/addatq.pl 0 0」<br>\n"; 
     177                }else{ 
     178                        print "[DEBUG]exec addatq.pl false 「$toolpath/perl/addatq.pl 0 0」<br>\n"; 
     179                         
     180                        $oserr = system("$toolpath/perl/perltestscript.pl"); 
     181                        if ($oserr){ 
     182                                print "[DEBUG]exec perltestscript.pl $oserr<br>\n"; 
     183                        }else{ 
     184                                print "[DEBUG]exec perltestscript.pl false <br>\n"; 
     185                        } 
     186                         
     187                } 
     188        //----------------------------------------------------- 
    172189        }else{ 
    173190                print "EPG予約を行う権限がありません。"; 
     
    200217}// 初回表示かデータ処理か 
    201218?> 
    202 <form id="record" name="record" method="get" action="./m.php"
     219<form id="record" name="record" method="get" action="./m.php" autocomplete="off"
    203220  <p>放送日: 
    204221    <input name="startdate" type="text" id="startdate" size="9" value="<?=$startdate?>" /> 
     
    215232<?php 
    216233$query = " 
    217 SELECT stationid,stationname,stationrecch ,digitalch  
     234SELECT stationid as x, stationname, stationrecch, digitalch  
    218235FROM foltia_station  
    219236WHERE stationrecch > 0  
     
    221238SELECT DISTINCT  stationid,stationname,stationrecch ,digitalch  
    222239FROM  foltia_station  
    223 WHERE digitalch > 0 
    224 ORDER BY \"stationid\" ASC"; 
    225  
    226         $stations = m_query($con, $query, "DBクエリに失敗しました"); 
    227         $stationcount = pg_num_rows($stations); 
    228          
    229 if ($stationcount > 0 ){ 
    230         for ($row = 0; $row < $stationcount ; $row++) { 
    231                 $rowdata = pg_fetch_row($stations, $row); 
     240WHERE digitalch > 0  
     241ORDER BY x ASC"; 
     242 
     243$stations = sql_query($con, $query, "DBクエリに失敗しました"); 
     244$rowdata = $stations->fetch(); 
     245 
     246if ($rowdata) { 
     247                           do { 
    232248                        if ($recstid == $rowdata[0]){ 
    233                         print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked />  $rowdata[1] ($rowdata[2]ch) \n"; 
     249                        print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked />  $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; 
    234250                        }else{ 
    235                                 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" />  $rowdata[1] ($rowdata[2]ch) \n"; 
     251                                print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" />  $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; 
    236252                        } 
    237         } 
     253                          } while ($rowdata = $stations->fetch()); 
    238254}else{ 
    239255print "放送局データベースが正しくセットアップされていません。録画可能局がありません"; 
    240256} 
    241  
     257//外部入力チャンネル 
    242258$query = " 
    243 SELECT stationid,stationname,stationrecch  
     259SELECT stationid as x ,stationname,stationrecch  
    244260FROM foltia_station  
    245261WHERE stationrecch > -2 AND stationrecch < 1  
    246 ORDER BY \"stationid\" ASC"; 
    247  
    248         $stations = m_query($con, $query, "DBクエリに失敗しました"); 
    249         $stationcount = pg_num_rows($stations); 
    250          
    251 if ($stationcount > 0 ){ 
    252         for ($row = 0; $row < $stationcount ; $row++) { 
    253                 $rowdata = pg_fetch_row($stations, $row); 
     262ORDER BY x ASC"; 
     263 
     264//      $stations = m_query($con, $query, "DBクエリに失敗しました"); 
     265        $stations = sql_query($con, $query, "DBクエリに失敗しました"); 
     266$rowdata = $stations->fetch();   
     267if ($rowdata) { 
     268        do { 
    254269                if ($rowdata[0] != 0){ 
    255270                        if ($recstid == $rowdata[0]){ 
     
    260275 
    261276                } 
    262         } 
     277        } while ($rowdata = $stations->fetch()); 
    263278} 
    264279/* 
track feed