Beispiel #1
0
<?php

include_once $_SERVER['DATING_ROOT'] . '/lib/init-global.php';
abstract class login extends \lib\actions
{
    public static function post()
    {
        if ($user = \lib\user::authenticate($_POST['username'], $_POST['password'])) {
            $_SESSION['user_id'] = $user['id'];
            return true;
        } else {
            return false;
        }
    }
}
login::run();
Beispiel #2
0
        $this->array["user"] = $_POST["userid"];
        $this->array["password"] = $_POST["password"];
    }
    function run()
    {
        $this->generate_query_array();
        return $this->db->DB_request_handler($this->array);
    }
    function stop()
    {
        $this->db->DB_close_mysql();
    }
}
$ret = "";
$main = new login("./conf.xml", $ret);
if ($ret == FALSE) {
    exit;
}
$ret = $main->run();
if ($ret == 1) {
    //printf("login sucess");
    setcookie("user", $_POST["userid"], time() + 3600);
    //header("Location:/edit_text.php");
    header("Location:/main_page.php");
} else {
    printf("login fail");
}
$main->stop();
?>