本文整理汇总了PHP中UserDB::GetUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::GetUser方法的具体用法?PHP UserDB::GetUser怎么用?PHP UserDB::GetUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDB
的用法示例。
在下文中一共展示了UserDB::GetUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBHandler
<?php
session_start();
include_once "db/BookReservationDB.php";
include_once "db/BookDB.php";
include_once "db/UserDB.php";
$db = new DBHandler();
$bookDB = new BookDB($db);
$reservationDB = new BookReservationDB($db);
$userDB = new UserDB($db);
$reservations = array();
$user = NULL;
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['userId'])) {
$user = $userDB->GetUser($_GET['userId']);
$reservations = $reservationDB->GetReservationForUser($user['id']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>BookÉTS</title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/icon" href="assets/images/favicon.ico"/>
<!-- Font Awesome -->
<link href="assets/css/font-awesome.css" rel="stylesheet">
<!-- Bootstrap -->
示例2: date
$date_start = date("Y-m-d");
$date_end = date('Y-m-d', strtotime('+' . $_POST['reservationLength']));
$reservations = $reservationDB->GetReservationsForBook($_POST['bookId']);
$book = $bookDB->GetBookById($_POST['bookId']);
if (count($reservations) >= $book['Count']) {
$errorMessage[] = "Aucun exemplaire disponible.";
}
$reservations = $reservationDB->GetReservationForUser($_POST['userId']);
if (count($reservations) >= $settings['MaxReservationCount']) {
$errorMessage[] = "Nombre maximum de réservations atteint.";
}
if (count($errorMessage) == 0) {
$reservationDB->AddReservation($date_start, $date_end, $_POST['bookId'], $_POST['userId']);
// Send Email to User
$userDB = new UserDB($db);
$user = $userDB->GetUser($_POST['userId']);
$Email = new MailSMTP();
$Email->send($user['email'], "Nouvelle Réservation", "Vous avec réservé le livre " . $book['title'] . " du " . $date_start . " au " . $date_end . ".");
?>
<span class="label label-success center-block">Réservé avec succès</span>
<?php
} else {
for ($i = 0; $i < count($errorMessage); $i++) {
?>
<span class="label label-danger center-block"><?php
echo $errorMessage[$i];
?>
</span>
<?php
}
}