本文整理汇总了PHP中UserDAO::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::getAll方法的具体用法?PHP UserDAO::getAll怎么用?PHP UserDAO::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDAO
的用法示例。
在下文中一共展示了UserDAO::getAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUser
public function checkUser($username, $password)
{
$count = 0;
$userDAO = new UserDAO();
$lijst = $userDAO->getAll();
foreach ($lijst as $user) {
if ($user->getUsername() == $username && $user->getPassword() == $password) {
$count++;
}
}
if ($count >= 1) {
$_SESSION["topSecret"] = "access granted";
} else {
$_SESSION["topSecret"] = "access denied";
echo "FALSE username and/or password";
}
}
示例2: PDO
$sql = "SELECT gebruikersnaam, wachtwoord FROM gebruikers";
$dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
$resultSet = $dbh->query($sql);
var_dump($resultSet);
$lijst = array();
foreach ($resultSet as $rij) {
$u = new User($rij["gebruikersnaam"], $rij["wachtwoord"]);
array_push($lijst, $u);
}
var_dump($lijst);
$dbh = null;
return $lijst;
}
}
$userDAO = new UserDAO();
$users = $userDAO->getAll();
var_dump($users);
$userDOA = new UserDAO();
$newUser = $userDAO->createUser("liesenborghs", "testpwd");
var_dump($newUser);
//class UserService {
//
// public function storeUser($username, $password) {
// $userDAO = new UserDAO();
// $userDAO->createUser($username, $password);
// }
//
// public function checkUser($username, $password) {
// $count = 0;
// $userDAO = new UserDAO();
// $userDAO->getAll();
示例3: redirect_to
$valid = false;
}
if ($valid == true) {
if (UserDAO::checkUsernameAvailable($user->username)) {
UserDAO::addUser($user);
redirect_to("ManageAdmins.php");
} else {
$message = "Username not available";
}
}
} catch (Exception $exception) {
echo "{\"success\":false}";
}
}
require "partials/header.php";
$admins = UserDAO::getAll();
?>
<div class="table-responsive" style="padding-top:200px;margin-left:150px;width:70%; ">
<h4>Manage admins</h4>
<h5 style="color:red">
<?php
echo $message;
?>
</h5>
<button class="btn btn-success btn-sm pull-right" data-target="#AddAdminModal" data-toggle="modal">Add Admin </button>
<br><br/>
<table class="table table-striped table-bordered">
<thead>
<tr>
<td>S.No.</td>
示例4: UserDAO
<?php
require_once 'Data/UserDAO.php';
require_once 'Data/ChallengeDAO.php';
require_once 'Data/WeighpointDAO.php';
require_once 'Data/ViewerDAO.php';
require_once 'algemenefuncties.php';
require_once 'Business/UserService.php';
require_once 'Business/ChallengeService.php';
$userDAO = new UserDAO();
$userLijst = $userDAO->getAll();
$challengeDAO = new ChallengeDAO();
$challengeLijst = $challengeDAO->getAll();
$weighpointDAO = new WeighpointDAO();
$weighpointLijst = $weighpointDAO->getAll();
$viewerDAO = new ViewerDAO();
$viewerLijst = $viewerDAO->getAll();
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
示例5: UserDAO
<?php
include_once 'Data/userDAO.php';
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$userDAO = new UserDAO();
$userlijst = $userDAO->getAll();
var_dump($userlijst);
?>
</body>
</html>