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


PHP UserDB::GetUser方法代碼示例

本文整理匯總了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 -->
開發者ID:Helpha,項目名稱:GTI510,代碼行數:31,代碼來源:viewAllReservation.php

示例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 
                }
            }
開發者ID:Helpha,項目名稱:GTI510,代碼行數:31,代碼來源:reservationREST.php


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