hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
srv
/
www
/
virtual
/
dev1.wccweb.jp.dac4.biz
/
web
/
biva.webapp
/
site
/
app
/
admin
/
Upload FileeE
HOME
<?php /** * admin/login.php * * @author Mitsutoshi Nakamura <mitsutoshi.nakamura.jp@gmail.com> * @since 2011/02/01 * @version PHP version 5 * @package BIVA */ require(BV_APPROOT . 'site/app/admin/_core.php'); class login extends core { public function __construct() { ini_set('display_errors', 1); error_reporting(-1); parent::__construct(); if (isset($this->ses['auth']['flag']) && $this->ses['auth']['flag']) { header('Location: ' . bvUriScheme() . bvUriDomain() . BV_DOCPATH . 'admin/'); } } public function pageIndex() { //$this->biva->setCss(); //$this->biva->setJs(); $this->biva->view('index'); } public function pageCheck() { if ($this->isValidUser()) { $this->ses['auth']['flag'] = true; $this->ses['auth']['user']['name'] ? $this->ses['auth']['username'] = $this->ses['auth']['user']['name'] : $this->ses['auth']['username'] = $this->ses['auth']['user']['login_id']; switch (true) { case isset($this->ses['auth']['req']) && $this->ses['auth']['req']: header('Location: ' . $this->ses['auth']['req']); break; default: header('Location: ' . bvUriScheme() . bvUriDomain() . BV_DOCPATH . 'admin/'); break; } } else { $this->pageIndex(); } } /** * User Authentication * * @return boolean */ private function isValidUser() { switch (true) { case !isset($_POST['loginId']) || $_POST['loginId'] === '': case !isset($_POST['loginPw']) || $_POST['loginPw'] === '': $this->tplvar['err'] = 'USERNAME or PASSWORD is invalid'; return false; case $_POST['loginId'] == BV_SYS_USER && md5($_POST['loginPw']) == BV_SYS_PASS: $this->ses['auth']['user'] = array('id' => 0, 'name' => BV_SYS_USER); $this->ses['auth']['isSU'] = true; return true; } // システム内部的にIDを変更 // futureform => cvstos switch ($_POST['loginId']) { case 'futureform': $_POST['loginId'] = 'cvstos'; break; } $sql_base = "SELECT * FROM a_user WHERE login_id = '%s' AND login_pw = MD5('%s')"; $sql = sprintf($sql_base, $this->biva->Db->escape($_POST['loginId']), $this->biva->Db->escape($_POST['loginPw'])); // echo $sql; exit; $r_sql = $this->biva->Db->query($sql); switch (true) { case mysqli_num_rows($r_sql) != 1: // case mysql_num_rows($r_sql) != 1: // 旧サーバー向け処理 $this->tplvar['err'] = 'USERNAME or PASSWORD is invalid'; return false; case !$rv = mysqli_fetch_assoc($r_sql): // case !$rv = mysql_fetch_assoc($r_sql): // 旧サーバー向け処理 $this->tplvar['err'] = 'CODE : 001'; // データ取得エラー return false; case $rv['status'] & 2: $this->tplvar['err'] = 'CODE : 002'; // 削除 return false; case $rv['status'] & 4: $this->tplvar['err'] = 'CODE : 003'; // 保留 return false; default: $this->ses['auth']['user'] = $rv; $this->ses['auth']['isSU'] = false; //$this->privilegeData(); return true; } } }