source: branches/dev/data/downloads/module/security/security.php @ 12103

Revision 12103, 4.3 KB checked in by naka, 19 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2006 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: ebis_tag.php,v 1.0 2006/10/26 04:02:40 naka Exp $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9 
10//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
11class LC_Page {
12    //¥³¥ó¥¹¥È¥é¥¯¥¿
13    function LC_Page() {
14        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
15        $this->tpl_mainpage = MODULE_PATH . 'security/security.tpl';
16        $this->tpl_subtitle = '¥»¥­¥å¥ê¥Æ¥£¥Á¥§¥Ã¥¯';
17    }
18}
19
20$objPage = new LC_Page();
21$objView = new SC_AdminView();
22
23switch($_POST['mode']) {
24case 'edit':
25    print("iei");
26    break;
27default:
28    break;
29}
30
31$arrList[] = sfCheckOpenData();
32$arrList[] = sfCheckInstall();
33$arrList[] = sfCheckIDPass('admin', 'password');
34$arrList[] = sfCheckInstallInc();
35
36$objPage->arrList = $arrList;
37
38$objView->assignobj($objPage);                  //ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
39$objView->display($objPage->tpl_mainpage);      //¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
40//-------------------------------------------------------------------------------------------------------
41// ÀßÄê¥Õ¥¡¥¤¥ë(data)¤Î¥Ñ¥¹¤¬¸ø³«¥Ñ¥¹¤Ç¤Ê¤¤¤«³Îǧ¤¹¤ë
42function sfCheckOpenData() {
43    // ¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È¤Î¥Ñ¥¹¤ò¿ä¬¤¹¤ë¡£
44    $doc_root = ereg_replace(URL_DIR . "$","/",HTML_PATH);
45    $data_path = realpath(DATA_PATH);
46   
47    // data¤Î¥Ñ¥¹¤¬¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼¤Ë¤¢¤ë¤«È½Äê
48    if(ereg("^".$doc_root, $data_path)) {
49        $arrResult['result'] = "¡ß";
50        $arrResult['detail'] = "ÀßÄê¥Õ¥¡¥¤¥ë¤¬¡¢¸ø³«¤µ¤ì¤Æ¤¤¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£<br>";
51        $arrResult['detail'].= "/data/¥Ç¥£¥ì¥¯¥È¥ê¤Ï¡¢Èó¸ø³«¤Î¥Ñ¥¹¤ËÀßÃÖ¤·¤Æ²¼¤µ¤¤¡£";
52    } else {
53        $arrResult['result'] = "¡û";
54        $arrResult['detail'] = "ÀßÄê¥Õ¥¡¥¤¥ë¤Ï¡¢¸ø³«¥Ñ¥¹ÇÛ²¼¤Ë¸ºß¤·¤Þ¤»¤ó¡£";       
55    }
56   
57    $arrResult['title'] = "ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÊݸ¥Ñ¥¹";
58    return $arrResult;
59}
60
61// ¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¤«³Îǧ¤¹¤ë
62function sfCheckInstall() {
63    // ¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥¡¥¤¥ë¤Î¸ºß¥Á¥§¥Ã¥¯
64    $inst_path = HTML_PATH . "install/index.php";
65   
66    if(file_exists($inst_path)) {
67        $arrResult['result'] = "¡ß";
68        $arrResult['detail'] = "/install/index.php¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë´°Î»¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£";           
69    } else {
70        $arrResult['result'] = "¡û";
71        $arrResult['detail'] = "/install/index.php¤Ï¡¢¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£";   
72    }
73   
74    $arrResult['title'] = "¥¤¥ó¥¹¥È¡¼¥ë¥Õ¥¡¥¤¥ë¤Î¥Á¥§¥Ã¥¯";
75    return $arrResult;
76}
77
78// ´ÉÍý¼Ô¥æ¡¼¥¶¤ÎID/¥Ñ¥¹¥ï¡¼¥É¥Á¥§¥Ã¥¯
79function sfCheckIDPass($user, $password) {
80    $objQuery = new SC_Query();
81    $sql = "SELECT password FROM dtb_member WHERE login_id = ?";
82    // DB¤«¤é°Å¹æ²½¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë¡£
83    $arrRet = $objQuery->getAll($sql, array($user));
84    // ¥æ¡¼¥¶ÆþÎϥѥ¹¥ï¡¼¥É¤ÎȽÄê
85    $ret = sha1($password . ":" . AUTH_MAGIC);
86   
87    if($ret == $arrRet[0]['password']) {
88        $arrResult['result'] = "¡ß";
89        $arrResult['detail'] = "Èó¾ï¤Ë¿ä¬¤Î¤·¤ä¤¹¤¤´ÉÍý¼ÔID¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¸Ä¿Í¾ðÊóϳ±Ì¤Î´í¸±À­¤¬¹â¤¤¤Ç¤¹¡£";       
90    } else {
91        if(count($arrRet) > 0) {
92            $arrResult['result'] = "¢¤";
93            $arrResult['detail'] = "´ÉÍý¼Ô̾¤Ë¡Öadmin¡×¤òÍøÍѤ·¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£";               
94        } else {
95            $arrResult['result'] = "¡û";
96            $arrResult['detail'] = "ÆÈ¼«¤ÎID¡¢¥Ñ¥¹¥ï¡¼¥É¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£";               
97        }
98    }
99   
100    $arrResult['title'] = "ID/¥Ñ¥¹¥ï¡¼¥É¤Î¥Á¥§¥Ã¥¯";
101    return $arrResult;
102}
103
104
105// install.inc¤Î¥Õ¥¡¥¤¥ë¤ò¥Á¥§¥Ã¥¯¤¹¤ë
106function sfCheckInstallInc() {
107    // install.inc¤Î¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë
108    $inst_inc = DATA_PATH . 'install.inc';
109    if(file_exists($inst_inc)) {
110        if($fp = fopen($inst_inc, "r")) {
111            $data = fread($fp, filesize($inst_inc));
112            fclose($fp);
113        }
114       
115        if(ereg("DB_PASSWORD", $data)) {
116            $arrResult['result'] = "¡ß";
117            $arrResult['detail'] = "install.inc¤ÎÆâÍÆ¤ò±£Êä·¤Þ¤¹¤«¡©<br>";
118            $arrResult['detail'].= "<input type='submit' value='±£Ê乤ë'>";       
119        } else {
120            $arrResult['result'] = "¡û";
121            $arrResult['detail'] = "install.inc¤Î±£ÊÃÂкö¤¬¤È¤é¤ì¤Æ¤¤¤Þ¤¹¡£";                       
122        }
123    } else {
124        $arrResult['result'] = "¡û";
125        $arrResult['detail'] = "install.inc¤Ï¡¢Â¸ºß¤·¤Þ¤»¤ó¡£";               
126    }
127   
128    $arrResult['title'] = "install.inc¤Î¥Á¥§¥Ã¥¯";
129    return $arrResult;
130}
131
132?>
Note: See TracBrowser for help on using the repository browser.