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
|
<?
require_once "Auth.php";
require_once "connect.php";
require_once "DB.php";
$db = DB::connect($dsn);
$db->setFetchMode(DB_FETCHMODE_ASSOC);
function myOutput($username, $status)
{
echo "<form method='post' action='test.php?login=1'>";
echo "<input type='text' name='email'>";
echo "<input type='password' name='password'>";
echo "<input type='submit'>";
echo "</form>";
}
$params = array(
"dsn" => $dsn,
"table" => "user",
"usernamecol" => "email",
"passwordcol" => "password"
);
$a = new Auth("DB", $params, "myOutput");
$a->start();
if ($a->checkAuth()) {
echo "<html>
<head>
<title>Ma page html</title>
</head>
</html>
";
}
?> |
Partager