예제 #1
0
파일: UserDb.php 프로젝트: oripuma/foodo
 public function addUser($firstName, $lastName, $email, $password)
 {
     $apikey = SHA1($email . $password . RAND() . time());
     $stmt = $this->pdo->prepare("INSERT INTO `users` (`firstName`, `lastName`, `email`,`password`, `apikey`) VALUES (?, ?, ?, SHA1(?), ?)");
     if ($stmt->execute(array($firstName, $lastName, $email, $password, $apikey))) {
         return $this->pdo->lastInsertId();
     } else {
         return 0;
     }
 }
예제 #2
0
파일: ReviewDb.php 프로젝트: oripuma/foodo
 public function insertReview($restaurant_id, $user_id, $review)
 {
     $sql = "INSERT INTO reviews (restaurant_id, user_id, review) VALUES (:rid, :uid, :review)";
     $q = $this->pdo->prepare($sql);
     if ($q->execute(array(':rid' => $restaurant_id, ':uid' => $user_id, ':review' => $review))) {
         return $this->selectFromId($this->pdo->lastInsertId());
     } else {
         return 0;
     }
 }