Beispiel #1
0
    {
        $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();
<?php

if (!isset($_SESSION)) {
    session_start();
} else {
    header("location: ../admincp.php");
}
include "../connection.php";
function __autoload($class_name)
{
    require_once $class_name . '.php';
}
if (isset($_POST["username"]) and isset($_POST["password"])) {
    if (!empty($_POST["username"]) and !empty($_POST["password"])) {
        $Login_class = new Login_class($dbh);
        if ($Login_class->check_credentials('admin_reg')) {
            $_SESSION["logged_in_admin"] = session_id();
            $_SESSION["username"] = $_POST["username"];
        } else {
            $error = "Wrong credentials";
        }
    } else {
        $error = "Username and password required";
    }
}
if (isset($_SESSION["logged_in_admin"])) {
    header("location: ../admin/admincp.php");
}
?>

<?php

if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION["logged_in_user"])) {
    header("location: ../member.php");
}
include "../connection.php";
include "../registration/registration_class.php";
include "login_class.php";
include "../get_config.php";
$Login = new Login_class($dbh);
if (isset($_POST["username"]) and isset($_POST["password"])) {
    if (!empty($_POST["username"]) and !empty($_POST["password"])) {
        if ($Login->check_credentials()) {
            if ($Login->is_admin()) {
                header("location: ../admin/admincp.php");
                $_SESSION["logged_in_admin"] = session_id();
                $_SESSION["logged_in_user"] = session_id();
                $_SESSION["username"] = $_POST["username"];
            } else {
                if (!$Login->is_acc_banned()) {
                    if (!$Login->is_ip_banned()) {
                        if (!$Login->is_ip_blacklisted($blacklist_ips)) {
                            if ($Login->is_user_acc_verified()) {
                                $_SESSION["logged_in_user"] = session_id();
                                $_SESSION["username"] = $_POST["username"];
                                header("location: ../member.php");
                            } else {
                                $error = "Please verify your account";