-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
executable file
·70 lines (63 loc) · 1.92 KB
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once("definitions/definitions.php"); //各種定数定義
require_once(DIR_FUNCTIONS ."chk_func.php");
require_once(DIR_CLASSES ."app_class.php");
class Login_class extends app_class{
private $account;
private $passwd;
private $err_msg;
function __construct(){
parent::__construct();
}
private function login_check(){
//必須チェック
$this->err_msg[] = indi_check($this->account,"ユーザーID");
$this->err_msg[] = indi_check($this->passwd,"パスワード");
if(!array_filter($this->err_msg)){
$this->sql = "SELECT * FROM " .TABLE_ACCNT
." WHERE account = ?"
." AND passwd = ?";
$this->prepare();
$this->data_array=array($this->account,$this->passwd);
$this->execute();
$row = $this->stmt->fetch(PDO::FETCH_ASSOC);
if($row["account"] == $this->account){
session_destroy();
session_start();
$_SESSION["sesUserID"] = $row["account"];
$_SESSION["sesUserNM"] = $row["user_name"];
$_SESSION["sesAdFlg"] = $row["admin_flg"];
header("Location: top.php");
}else{
$this->err_msg[]="ユーザーIDまたはパスワードが間違っています。";
}
}
}
function sub_init(){
$this->err_msg = array();
if(isset($_POST["s_login"])){ //s_loginはsubmitボタン押下
$this->account = $_POST["account"];
$this->passwd = $_POST["passwd"];
$this->login_check();
}
}
function sub_main(){
}
function sub_disp(){
$this->smarty_obj->assign("t_html_title",$this->get_env("page_name") ."|ログイン");
$this->smarty_obj->assign("page_title","ログイン");
$this->smarty_obj->assign("err_msg",$this->err_msg);
$this->smarty_obj->display("login.tpl");
}
function __destruct(){
parent::__destruct();
}
}
session_start();
//session_unset();
//session_destroy();
$init_obj = new Login_class;
$init_obj->sub_init();
$init_obj->sub_main();
$init_obj->sub_disp();
?>