root/trunk/install/php/foltialib.php

リビジョン 94, 18.0 kB (コミッタ: sorshi, コミット時期: 14 年 前)

SQLite採用

Line 
1 <?php
2         
3 include("./foltia_config2.php");
4
5 /*
6 こちらのモジュールは
7 Apache + PHP + PostgreSQL 実験室
8 http://www.hizlab.net/app/
9 のサンプルを使わせていただいております。
10 ありがとうございます。
11 */
12
13     /* エラー表示の抑制 */
14     //error_reporting(0);
15
16     
17     //GET用フォームデコード
18       function getgetform($key) {
19     if ($_GET["{$key}"] != "") {
20         $value = $_GET["{$key}"];
21         $value = escape_string($value);
22         $value = htmlspecialchars($value);
23     return ($value);
24     }
25   }
26     //GET用数字フォームデコード
27       function getgetnumform($key) {
28 //    if ($_GET["{$key}"] != "") {
29     if (isset($_GET["{$key}"] )) {
30         $value = $_GET["{$key}"];
31         $value = ereg_replace("[^-0-9]", "", $value);
32         $value = escape_numeric($value);
33     return ($value);
34     }
35   }
36     
37     //フォームデコード
38       function getform($key) {
39     if ($_POST["{$key}"] != "") {
40         $value = $_POST["{$key}"];
41         $value = escape_string($value);
42         $value = htmlspecialchars($value);
43     return ($value);
44     }
45   }
46     //数字専用フォームデコード
47       function getnumform($key) {
48     if ($_POST["{$key}"] != "") {
49         $value = $_POST["{$key}"];
50         $value = escape_string($value);
51         $value = htmlspecialchars($value);
52         $value = ereg_replace("[^0-9]", "", $value);
53         $value = escape_numeric($value);
54     return ($value);
55     }
56   }
57
58     /* 全角カタカナ化してスペースを削除してインデックス用にする */
59     function name2read($name) {
60     $name = mb_convert_kana($name, "KVC", "EUC-JP");
61     $name = mb_convert_kana($name, "s", "EUC-JP");
62     $name = ereg_replace(" ", "", $name);
63
64         return $name;
65     }
66
67     /* 数字を半角化して数字化してインデックス用にする */
68     function pnum2dnum($num) {
69     $num = mb_convert_kana($num, "a", "EUC-JP");
70     $num = ereg_replace("[^0-9]", "", $num);
71
72         return $num;
73     }
74     
75     /* 終了関数の定義 */
76     function die_exit($message) {
77         ?>
78         <p class="error"><?= $message ?></p>
79         <div class="index"><a href="./">トップ</a></div>
80     </body>
81 </html><?php
82         exit;
83     }
84     
85     /* 入力した値のサイズをチェック */
86     function check_length($str, $maxlen, $must, $name) {
87         $len = strlen($str);
88         if ($must && $len == 0) {
89             die_exit("$name が入力されてません。必須項目です。");
90         }
91         if ($len > $maxlen) {
92             die_exit("$name は $len 文字以下で入力して下さい。全角文字は、一文字で二文字分と計算されます。");
93         }
94     }
95
96     /* SQL 文字列のエスケープ */
97     function escape_string($sql, $quote = FALSE) {
98         if ($quote && strlen($sql) == 0) {
99             return "null";
100         }
101         if (preg_match("/^pgsql/", DSN)){
102         return ($quote ? "'" : "") .
103                pg_escape_string($sql) .
104                ($quote ? "'" : "");
105         }else if (preg_match("/^sqlite/", DSN)){
106         /*    return ($quote ? "'" : "") .
107                 sqlite_escape_string($sql) .
108                 ($quote ? "'" : "");
109         */
110         return($sql);
111         }else{
112             return "null";
113         }
114     }
115     
116     /* SQL 数値のエスケープ */
117     function escape_numeric($sql) {
118         if (strlen($sql) == 0) {
119             return "null";
120         }
121         if (!is_numeric($sql)) {
122             die_exit("$sql は数値ではありません。");
123         }
124         return $sql;
125     }
126     
127     /* DBに接続 */
128     function m_connect() {
129     try {
130         $dbh = new PDO(DSN);
131         $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
132         return($dbh);
133     } catch (PDOException $e) {
134         die_exit($e->getMessage() . ": データベースに接続出来ませんでした。");
135         }
136         /* データベースと、PHP の内部文字コードが違う場合 */
137     }
138
139     /* データベースとの接続を切り離す */
140 function m_close($dbh) {
141     return null;
142     }
143
144 //旧関数 sql_queryに置き換え
145 function m_query($dbh, $query, $errmessage) {
146     try {
147         $rtn = $dbh->query($query);
148         return($rtn);
149     } catch (PDOException $e) {
150             /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */
151             $msg = $errmessage . "<br>\n" .
152             $e->getMessage() . "<br>\n" .
153             var_export($e->errorInfo, true) . "<br>\n" .
154                    "<small><code>" . htmlspecialchars($query) .
155                    "</code></small>\n";
156 //        $dbh->rollBack();
157         $dbh = null;
158             die_exit($msg);
159         }
160     }
161 /* SQL 文を実行 */
162 function sql_query($dbh, $query, $errmessage,$paramarray) {
163     try {
164         $rtn = $dbh->prepare("$query");
165         $rtn->execute($paramarray);
166         return($rtn);
167     } catch (PDOException $e) {
168             /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */
169             $msg = $errmessage . "<br>\n" .
170             $e->getMessage() . "<br>\n" .
171             var_export($e->errorInfo, true) . "<br>\n" .
172                    "<small><code>" . htmlspecialchars($query) .
173                    "</code></small>\n";
174 //        $dbh->rollBack();
175         $dbh = null;
176             die_exit($msg);
177         }
178     }
179
180     /* select した結果をテーブルで表示 */
181     function m_showtable($rs) {
182         /* 検索件数 */
183     $maxrows = 0;
184         
185     $rowdata = $rs->fetch();
186     if (! $rowdata) {
187             echo("<p class=\"msg\">データが存在しません</p>\n");
188             return 0;
189         }
190         
191         /* フィールド数 */
192     $maxcols = $rs->columnCount();
193         ?>
194 <table class="list" summary="データ検索結果を表示" border="1">
195     <thead>
196         <tr>
197             <?php
198                 /* テーブルのヘッダーを出力 */
199                 for ($col = 1; $col < $maxcols; $col++) {
200                     /* pg_field_name() はフィールド名を返す */
201              $meta = $rs->getColumnMeta($col);
202              $f_name = htmlspecialchars($meta["name"]);
203                     echo("<th abbr=\"$f_name\">$f_name</th>\n");
204                 }
205             ?>
206         </tr>
207     </thead>
208     <tbody>
209         <?php
210             /* テーブルのデータを出力 */
211           do {
212               $maxrows++;
213
214                 echo("<tr>\n");
215                 /* 1列目にリンクを張る */
216                 echo("<td><a href=\"edit.php?q_code=" .
217                      urlencode($rowdata[0]) . "\">" .
218                      htmlspecialchars($rowdata[1]) . "</a></td>\n");
219                 for ($col = 2; $col < $maxcols; $col++) { /* 列に対応 */
220                     echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n");
221                 }
222                 echo("</tr>\n");
223           } while ($rowdata = $rs->fetch());
224         ?>
225     </tbody>
226 </table>
227         <?php
228         return $maxrows;
229     }
230
231
232 function m_viewdata($dbh, $code) {
233
234 /*これ使ってないよね?
235
236     $query = "
237 select p.code
238       ,p.name
239       ,p.email
240       ,p.pseudonym
241       ,s.name as job
242       ,p.profile
243       ,datetime(p.editdate) as editdate
244   from inet_profile p left join inet_job s on p.job = s.code
245  where p.code = $code";
246     $rs = m_query($dbh, $query, "個人情報の取得に失敗しました。");
247     $rowdata = $rs->fetch();
248     if (! $rowdata) {
249             echo("<p class=\"msg\">データが存在しません</p>\n");
250             return FALSE;
251         }
252         
253         // フィールド数
254     $maxcols = $rs->columnCount();
255         ?>
256 <table class="view" summary="データベース上のデータを表示" border="1">
257     <tr>
258          <?php $meta = $rs->getColumnMeta(1); ?>
259          <td class="name"><?= htmlspecialchars($meta["name"]) ?></td>
260         <td><a href="edit.php?q_code=<?= $rowdata[0] ?>"
261              ><?= htmlspecialchars($rowdata[1]) ?></a></td>
262     </tr>
263          <?php for ($col = 2; $col < $maxcols; $col++) {
264         $meta = $rs->getColumnMeta($col); ?>
265     <tr>
266         <td class="name"><?= htmlspecialchars($meta["name"]) ?></td>
267         <td><?= htmlspecialchars($rowdata[$col]) ?></td>
268     </tr>
269     <?php } ?>
270 </table>
271         <?php
272         // クエリーを解放
273       $rs = null;
274         return TRUE;
275 */
276     }
277     
278
279 function printhtmlpageheader(){
280
281 global $useenvironmentpolicy;
282
283 $serveruri = getserveruri();
284 $username = $_SERVER['PHP_AUTH_USER'];
285
286 print "<p align='left'><font color='#494949'><A HREF = 'http://www.dcc-jpl.com/soft/foltia/' target=\"_blank\">foltia</A> | <A HREF = './index.php'>放映予定</A> | <A HREF = './index.php?mode=new'>新番組</A> | <A HREF = './listreserve.php'>予約一覧</A> | <A HREF = './titlelist.php'>番組一覧</A> | <A HREF = './viewepg.php'>番組表</A> | 録画一覧(<A HREF = './showplaylist.php'>録画順</A>・<A HREF = './showplaylist.php?list=title'>番組順</A>・<A HREF = './showplaylist.php?list=raw'>全</A>) | <A HREF = './showlib.php'>録画ライブラリ</A> |  <A HREF = './folcast.php'>Folcast</A>[<a href=\"itpc://$serveruri/folcast.php\">iTunesに登録</a>] | ";
287 if ($useenvironmentpolicy == 1){
288     print "【 $username 】";
289 }
290
291 print "</font></p>\n";
292
293 }
294
295
296 function renderepgstation($con,$stationname,$start){ //戻り値 なし EPGの局表示
297
298 $now = date("YmdHi");
299 $today = date("Ymd");   
300 $tomorrow = date ("Ymd",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y")));
301 //$today = "20051013";   
302 //$tomorrow = "20051014";
303 //$epgstart = $today . "2000";
304 $epgstart = $start ;
305 //$epgend = $tomorrow . "0400";
306 $epgend = calcendtime($start , (8*60));
307 $query = "
308 SELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory  ,ontvchannel  ,epgid
309 FROM foltia_epg
310 WHERE foltia_epg.ontvchannel = '$stationname' AND
311 enddatetime  > $epgstart  AND
312 startdatetime  < $epgend 
313 ORDER BY foltia_epg.startdatetime  ASC
314     ";
315     $rs = m_query($con, $query, "DBクエリに失敗しました");
316     $rowdata = $rs->fetch();
317     if (! $rowdata) {
318         print("番組データがありません<BR>");           
319 }else{
320 print "<table width=\"100%\"  border=\"0\">\n";
321 //print "<ul><!-- ($maxrows) $query -->\n";
322
323         do {
324 $printstarttime = substr($rowdata[0],8,2) . ":" substr($rowdata[0],10,2);
325 $tdclass = "t".substr($rowdata[0],8,2) .  substr($rowdata[0],10,2);
326 $title = htmlspecialchars($rowdata[3]);
327 $title = z2h($title);
328 $desc = htmlspecialchars($rowdata[4]);
329 $desc = z2h($desc);
330 $height htmlspecialchars($rowdata[2]) * 3;
331 $epgid htmlspecialchars($rowdata[7]);
332
333 print"
334       <tr>
335         <td height = \"$height\" >$printstarttime  <A HREF=\"./reserveepg.php?epgid=$epgid\">$title</A> $desc <!-- $rowdata[0] - $rowdata[1] --></td>
336       </tr>
337 ";
338 /*print"<li style=\"height:" . $height ."px;\" class=\"$tdclass\">
339 $printstarttime  <A HREF=\"./reserveepg.php?epgid=$epgid\">$title</A> $desc($rowdata[0] - $rowdata[1])
340 </li>\n";
341 */
342         } while ($rowdata = $rs->fetch());//do
343 //print "</ul>\n";
344 print "</table>\n";
345
346 }//if
347 }//end function
348
349 function calcendtime($start,$lengthmin){//戻り値 終了時刻(Ex:200510170130)
350 $startyear =   substr($start,0,4);
351 $startmonth =   substr($start,4,2);
352 $startday =   substr($start,6,2);
353 $starthour =   substr($start,8,2);
354 $startmin =   substr($start,10,2);
355 //int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] )
356 $endtime = date ("YmdHi",mktime($starthour  , $startmin + $lengthmin , 0, $startmonth  , $startday, $startyear));
357
358 return ($endtime );
359 }//end function
360
361
362 function z2h($string){ //戻り値 半角化した文字
363     $stringh = mb_convert_kana($string, "a", "EUC-JP");
364  return ($stringh );
365 }
366
367 function foldate2rfc822($start){//戻り値 RFC822スタイルの時刻表記
368     $startyear =   substr($start,0,4);
369     $startmonth =   substr($start,4,2);
370     $startday =   substr($start,6,2);
371     $starthour =   substr($start,8,2);
372     $startmin =   substr($start,10,2);
373
374     $rfc822 = date ("r",mktime($starthour  , $startmin , 0, $startmonth  , $startday, $startyear));
375     
376     return ($rfc822);
377 }//end sub
378
379 function foldate2print($start){//戻り値 日本語風時刻表記
380     $startyear =   substr($start,0,4);
381     $startmonth =   substr($start,4,2);
382     $startday =   substr($start,6,2);
383     $starthour =   substr($start,8,2);
384     $startmin =   substr($start,10,2);
385
386     $printabledate = date ("Y/m/d H:i",mktime($starthour  , $startmin , 0, $startmonth  , $startday, $startyear));   
387     return ($printabledate);
388 }//end sub
389
390 function getserveruri(){//戻り値 サーバアドレス Ex.www.dcc-jpl.com:8800/soft/foltia/
391
392 //リンクURI組み立て
393 $sv6 = $_SERVER['SCRIPT_NAME'];///dameNews/sarasorjyu/archives.php
394 $sv8 = $_SERVER['SERVER_NAME'];//sync.dcc-jpl.com
395 $sv9 = $_SERVER['SERVER_PORT'];
396 if ($sv9 == 80){
397     $port = "";
398 }else{
399     $port = ":$sv9";
400 }
401 $a = split("/", $sv6);
402 array_pop($a);
403
404 $scriptpath = implode("/", $a);
405
406 $serveruri = "$sv8$port$scriptpath";
407 return ($serveruri );
408 }//end sub
409
410
411 function getserverfqdn(){//戻り値 サーバアドレス Ex.www.dcc-jpl.com:8800
412
413 //リンクURI組み立て
414 $sv6 = $_SERVER['SCRIPT_NAME'];///dameNews/sarasorjyu/archives.php
415 $sv8 = $_SERVER['SERVER_NAME'];//sync.dcc-jpl.com
416 $sv9 = $_SERVER['SERVER_PORT'];
417 if ($sv9 == 80){
418     $port = "";
419 }else{
420     $port = ":$sv9";
421 }
422 $a = split("/", $sv6);
423 array_pop($a);
424
425 $scriptpath = implode("/", $a);
426
427 $serveruri = "$sv8$port";
428 return ($serveruri );
429 }//end sub
430
431
432 function printdiskusage(){//戻り値 なし
433 list (, $all, $use , $free, $usepercent) =  getdiskusage();
434
435 print "
436 <div style=\"width:100%;border:1px solid black;text-align:left;\"><span style=\"float:right;\">$free</span>
437 <div style=\"width:$usepercent;border:1px solid black;background:white;\">$use/$all($usepercent)</div>
438 </div>
439 ";
440 //exec('ps ax | grep ffmpeg |grep MP4 ' ,$ffmpegprocesses);
441 }//end sub
442
443
444 function getdiskusage(){//戻り値 配列 [,全体容量, 使用容量 , 空き容量, 利用割合]
445
446 global $recfolderpath,$recfolderpath;
447
448 //    exec ( "df -h  $recfolderpath | grep $recfolderpath", $hdfreearea);
449 //    $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]);
450     exec ( "df -hP  $recfolderpath", $hdfreearea);
451     $freearea = preg_split ("/[\s,]+/", $hdfreearea[count($hdfreearea)-1]);
452
453     return $freearea;
454     
455 }//endsub
456
457
458 function printtrcnprocesses(){
459
460 $ffmpegprocesses = `ps ax | grep ffmpeg | grep -v grep |  wc -l `;
461 $uptime = exec('uptime');
462
463 print "<div style=\"text-align:left;\">";
464 print "$uptime<br>\n";
465 print "トラコン稼働数:$ffmpegprocesses<br>\n";
466 print "</div>";
467
468 }//endsub
469
470
471 function warndiskfreearea(){
472
473 global $demomode;
474
475 if ($demomode){
476 print "<!-- demo mode -->";
477 }else{
478
479 global $recfolderpath,$hdfreearea ;
480
481     exec ( "df   $recfolderpath | grep $recfolderpath", $hdfreearea);
482     $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]);
483 $freebytes = $freearea[3];
484 if ($freebytes == "" ){
485 //
486 //print "<!-- err:\$freebytes is null -->";
487 }elseif($freebytes > 1024*1024*100 ){// 100GB以上あいてれば
488 //なにもしない
489 print "<style type=\"text/css\"><!-- --></style>";
490 }elseif($freebytes > 1024*1024*50 ){// 100GB以下
491 print "<style type=\"text/css\"><!--
492     body {
493     background-color: #CCCC99;
494      }
495 -->
496 </style>
497 ";
498 }elseif($freebytes > 1024*1024*30 ){// 50GB以下
499 print "<style type=\"text/css\"><!--
500     body {
501     background-color:#CC6666;
502      }
503 -->
504 </style>
505 ";
506 }elseif($freebytes > 0 ){// 30GB以下
507 print "<style type=\"text/css\"><!--
508     body {
509     background-color:#FF0000;
510      }
511 -->
512 </style>
513 ";
514 }else{ //空き容量 0バイト
515 print "<style type=\"text/css\"><!--
516     body {
517     background-color:#000000;
518      }
519 -->
520 </style>
521 ";
522 }//endif freebytess
523
524 }//endif demomode
525
526 }//endsub
527
528
529
530 function foldatevalidation($foldate){
531
532 if (strlen($foldate) == 12 ){
533
534     $startyear =   substr($foldate,0,4);
535     $startmonth =   substr($foldate,4,2);
536     $startday =   substr($foldate,6,2);
537     $starthour =   substr($foldate,8,2);
538     $startmin =   substr($foldate,10,2);
539
540     $startepoch = date ("U",mktime($starthour  , $startmin , 0, $startmonth  , $startday, $startyear));   
541     $nowe = time();
542     if ($startepoch > $nowe){
543     //print "$foldate:$startepoch:$nowe";
544         return TRUE;
545     }else{
546         return FALSE;
547     }    //end if $startepoch > $nowe
548 }else{
549     return FALSE;
550 }//end if ($foldate) == 12
551
552 }//end function
553
554
555
556 function login($con,$name,$passwd){
557 global $environmentpolicytoken;
558
559 //入力内容確認
560  if (((mb_ereg('[^0-9a-zA-Z]', $name)) ||(mb_ereg('[^0-9a-zA-Z]', $passwd) ))){
561     
562     //print "エラー処理\n";
563     //print "<!-- DEBUG name/passwd format error-->";
564     redirectlogin();
565     
566 }else{
567 //print "正常処理\n";
568 //db検索
569 escape_string($name);
570 escape_string($passwd);
571
572 $query = "
573 SELECT memberid ,userclass,name,passwd1
574 FROM foltia_envpolicy
575 WHERE foltia_envpolicy.name  = '$name' 
576     ";
577     $useraccount = m_query($con, $query, "DBクエリに失敗しました");
578         $rowdata = $useraccount->fetch();
579         if (! $rowdata) {
580             header("HTTP/1.0 401 Unauthorized");
581             redirectlogin();
582         }
583     
584         $memberid = $rowdata[0];
585         $userclass = $rowdata[1];
586         $username $rowdata[2];
587         $dbpasswd = $rowdata[3];
588
589         $rowdata = $useraccount->fetch();
590         if ($rowdata) {
591         header("HTTP/1.0 401 Unauthorized");
592         redirectlogin();
593         }
594
595 // passwdをdbから取りだし
596 if ($userclass == 0){
597 $dbpasswd = "$dbpasswd";
598 }else{
599 // db passwdとトークンを連結し
600 $dbpasswd = "$dbpasswd"."$environmentpolicytoken";
601 }
602 //それが入力と一致すれば認証
603 if ($passwd == $dbpasswd) {
604 //print "認証成功<br>$dbpasswd  $passwd\n";
605 }else{
606 //print "認証失敗<br>$dbpasswd  $passwd\n";
607         header("HTTP/1.0 401 Unauthorized");
608         //print "<!-- DEBUG passwd unmatch error>";
609         redirectlogin();
610 }
611 }//end if mb_ereg
612 }//end function login
613
614
615
616
617 function redirectlogin(){
618 global $environmentpolicytoken;
619
620 print "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n";
621 print "<html><head>\n";
622 print "<title>foltia:Invalid login</title>\n";
623 print "</head><body>\n";
624 print "<h1>Invalid login</h1>";
625 print "<p>foltiaヘのアクセスにはログインが必要です。再ログインはリロードやブラウザ再起動で、新規アカウント登録は<a href=\"./accountregist.php\">こちらから。</a></p>";
626 if ($environmentpolicytoken == ""){
627 }else{
628     print "<p>突然この画面が表示された場合にはセキュリティコードが変更されたかも知れません。</p>";
629 }
630 print "</p><hr>\n";
631 print "<address>foltia by DCC-JPL Japan/foltia Project.  <a href = \"http://www.dcc-jpl.com/soft/foltia/\">http://www.dcc-jpl.com/soft/foltia/</a></address>\n";
632 print "</body></html>\n";
633
634
635
636 exit;
637 }//end function redirectlogin
638
639 function getuserclass($con){
640 global $useenvironmentpolicy;
641 $username = $_SERVER['PHP_AUTH_USER'];
642
643 if ($useenvironmentpolicy == 1){
644 $query = "
645 SELECT memberid ,userclass,name,passwd1
646 FROM foltia_envpolicy
647 WHERE foltia_envpolicy.name  = '$username' 
648     ";
649         $useraccount = m_query($con, $query, "DBクエリに失敗しました");
650         $rowdata = $useraccount->fetch();
651         if (! $rowdata) {
652             return (99);
653         }
654     
655         $userclass = $rowdata[1];
656
657         $rowdata = $useraccount->fetch();
658         if ($rowdata) {
659             return (99);
660         }
661
662         return ($userclass);
663     
664 }else{
665     return (0);//環境ポリシー使わないときはつねに特権モード
666 }//end if
667 }//end function getuserclass
668
669
670
671 function getmymemberid($con){
672 global $useenvironmentpolicy;
673 $username = $_SERVER['PHP_AUTH_USER'];
674
675 if ($useenvironmentpolicy == 1){
676 $query = "
677 SELECT memberid ,userclass,name,passwd1
678 FROM foltia_envpolicy
679 WHERE foltia_envpolicy.name  = '$username' 
680     ";
681         $useraccount = m_query($con, $query, "DBクエリに失敗しました");
682         $rowdata = $useraccount->fetch();
683         if (! $rowdata) {
684     return (-1);//エラー
685         }
686
687         $memberid = $rowdata[0];
688
689         $rowdata = $useraccount->fetch();
690         if ($rowdata) {
691             return (-1);
692         }
693
694         return ($memberid);
695     
696 }else{
697     return (0);//環境ポリシー使わないときはつねに特権モード
698 }//end if
699 }//end function getuserclass
700
701
702 function getmemberid2name($con,$memberid){
703 global $useenvironmentpolicy;
704 //$username = $_SERVER['PHP_AUTH_USER'];
705
706 if ($useenvironmentpolicy == 1){
707 $query = "
708 SELECT memberid ,userclass,name,passwd1
709 FROM foltia_envpolicy
710 WHERE foltia_envpolicy.memberid  = '$memberid' 
711     ";
712         $useraccount = m_query($con, $query, "DBクエリに失敗しました");
713         $rowdata = $useraccount->fetch();
714         if (! $rowdata) {
715     return ("");//エラー
716         }
717     
718         $name = $rowdata[2];
719
720         $rowdata = $useraccount->fetch();
721         if ($rowdata) {
722     return ("");
723         }
724
725         return ($name);
726
727     }else{
728         return ("");
729     }//end if
730
731 }//end function getmemberid2name
732
733 ?>
734
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed