summaryrefslogtreecommitdiff
path: root/vendor/adodb/adodb-php/pear/auth_adodb_example.php
blob: 3b7cf5e851d787ea9d791a9af09c5eaa0371f6e0 (plain)
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
<?php
// NOTE: The ADOdb and PEAR directories MUST be in your PHP include_path!
require_once "Auth/Auth.php";

function loginFunction() {
?>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit">
    </form>
<?php
}

$dsn = 'mysql://username:password@hostname/database';
// To use encrypted passwords, change cryptType to 'md5'
$params = array('dsn' => $dsn, 'table' => 'auth', 'cryptType' => 'none',
                'usernamecol' => 'username', 'passwordcol' => 'password');
$a = new Auth("ADOdb", $params, "loginFunction");
$a->start();

if ($a->getAuth()) {
    echo "Success";
    // * The output of your site goes here.
}