avryhof/auth

类似于Pear Auth的认证类

dev-master 2014-11-11 18:56 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:13:15 UTC


README

一个类似于Pear Auth的认证类(http://pear.php.net/package/Auth/

这个类主要是由于当我尝试使用pear/auth时,composer引发了许多我不想解决的依赖问题。它还设计得更加轻量,对pear/auth的要求更少,同时保持了一些兼容的API。

示例

  require_once("auth.php");
  or
  require("vendor/autoload.php")

  $auth_options = array(
    "dsn" => "mysqli://".$dsn,
    "table" => "users",
    "usernamecol" => "email",
    "passwordcol" => "password",
    "db_fields" => array("id","name")
  );
  $auth = new Auth("Database", $auth_options, "", false);

  $auth->start();

  if (!$auth->checkAuth()) {
      header("Location:".$baseurl."/login.php");
  }

Also related
=============
- https://github.com/avryhof/database
- http://pear.php.net/package/Auth/docs