Index: trunk/install/php/foltialib.php =================================================================== --- trunk/install/php/foltialib.php (リビジョン 67) +++ trunk/install/php/foltialib.php (リビジョン 70) @@ -261,7 +261,15 @@ function printhtmlpageheader(){ +global $useenvironmentpolicy; + $serveruri = getserveruri(); - -print "

foltia | 放映予定 | 新番組 | 予約一覧 | 番組一覧 | 番組表 | 録画一覧(録画順番組順) | 録画ライブラリ | Folcast(RSS)[iTunesにFolcastを登録] |

\n"; +$username = $_SERVER['PHP_AUTH_USER']; + +print "

foltia | 放映予定 | 新番組 | 予約一覧 | 番組一覧 | 番組表 | 録画一覧(録画順番組順) | 録画ライブラリ | Folcast[iTunesに登録] | "; +if ($useenvironmentpolicy == 1){ + print "【 $username 】"; +} + +print "

\n"; } @@ -529,15 +537,161 @@ - - - - - - - - - - - +function login($con,$name,$passwd){ +global $environmentpolicytoken; + +//入力内容確認 + if (((mb_ereg('[^0-9a-zA-Z]', $name)) ||(mb_ereg('[^0-9a-zA-Z]', $passwd) ))){ + + //print "エラー処理\n"; + //print ""; + redirectlogin(); + +}else{ +//print "正常処理\n"; +//db検索 +escape_string($name); +escape_string($passwd); + +$query = " +SELECT memberid ,userclass,name,passwd1 +FROM foltia_envpolicy +WHERE foltia_envpolicy.name = '$name' + "; + $useraccount = m_query($con, $query, "DBクエリに失敗しました"); + $useraccountrows = pg_num_rows($useraccount); + + if ($useraccountrows == 1 ){ + $rowdata = pg_fetch_row($useraccount, 0); + $memberid = $rowdata[0]; + $userclass = $rowdata[1]; + $username = $rowdata[2]; + $dbpasswd = $rowdata[3]; + }else{ + header("HTTP/1.0 401 Unauthorized"); + //print ""; + redirectlogin(); + }//end if + + +// passwdをdbから取りだし +if ($userclass == 0){ +$dbpasswd = "$dbpasswd"; +}else{ +// db passwdとトークンを連結し +$dbpasswd = "$dbpasswd"."$environmentpolicytoken"; +} +//それが入力と一致すれば認証 +if ($passwd == $dbpasswd) { +//print "認証成功
$dbpasswd $passwd\n"; +}else{ +//print "認証失敗
$dbpasswd $passwd\n"; + header("HTTP/1.0 401 Unauthorized"); + //print "