當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBConnector::addUser方法代碼示例

本文整理匯總了PHP中DBConnector::addUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBConnector::addUser方法的具體用法?PHP DBConnector::addUser怎麽用?PHP DBConnector::addUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBConnector的用法示例。


在下文中一共展示了DBConnector::addUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: DBConnector

 $db = new DBConnector('palma-test.db');
 $db->resetTables();
 //~ http://stackoverflow.com/questions/1964233/does-sqlite3-support-a-trigger-to-automatically-update-an-updated-on-datetime
 //~ https://www.sqlite.org/lang_createtrigger.html
 // TODO: Test database triggers (can be used in db.php).
 //~ $db->createFunction('dbModifiedCallback', 'dbModifiedCallback', 0);
 // {AFTER | BEFORE} {DELETE | INSERT | UPDATE } ON table
 //~ $db->exec("CREATE TRIGGER dbchange AFTER UPDATE ON user
 //~ BEGIN
 //~ dbModifiedCallback();
 //~ END");
 //~ $db = new DBConnector('palma.db');
 echo "Tables=" . $db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table"') . "\n";
 var_dump($db->query("SELECT * from sqlite_master"));
 $address = $db->ipAddress();
 $db->addUser('testuser1', $address);
 //~ $db->addUser('testuser2', $address);
 //~ $db->addUser('testuser3', $address);
 //~ $db->addUser('testuser4', $address);
 $users = $db->getUsers();
 $db->enableUser('testuser1');
 var_dump($users);
 $db->delUser('haenger', $address);
 $db->delUser('ivwz', $address);
 $db->delUser('skrieg', $address);
 $db->delUser('testuser1', $address);
 $db->delUser('testuser2', $address);
 $db->delUser('testuser3', $address);
 $db->delUser('testuser4', $address);
 echo "Query=" . $db->querySingle('select name from user') . "\n";
 echo "Query=" . $db->querySingle('select count(name) from user') . "\n";
開發者ID:gertiksxx,項目名稱:PalMA,代碼行數:31,代碼來源:DBConnector.class.php

示例2: trace

    }
    if (CONFIG_PASSWORD && !checkCredentials($username, $password)) {
        // Invalid username or password.
    } else {
        if (CONFIG_PIN && $pin != $posted_pin) {
            trace("access denied for user '{$username}', wrong pin {$posted_pin}");
            $errtext = _('Invalid PIN.');
        } else {
            // Successfully checked username, password and PIN.
            trace("access granted for user '{$username}'");
            $_SESSION['username'] = $username;
            $_SESSION['address'] = $dbcon->ipAddress();
            $_SESSION['pin'] = $pin;
            $_SESSION['starturl'] = CONFIG_START_URL;
            $_SESSION['monitor'] = CONFIG_STATIONNAME;
            $dbcon->addUser($username, $dbcon->ipAddress(), getDevice());
            // Weiterleitung zur geschützten Startseite
            if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
                if (php_sapi_name() == 'cgi') {
                    header('Status: 303 See Other');
                } else {
                    header('HTTP/1.1 303 See Other');
                }
            }
            header('Location: ' . CONFIG_START_URL);
            exit;
        }
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
開發者ID:gertiksxx,項目名稱:PalMA,代碼行數:31,代碼來源:login.php


注:本文中的DBConnector::addUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。