Example #1
0
 public function saveNewUser(User $user)
 {
     // These values should be sanitized
     // I believe this is fixed
     $query = "INSERT INTO users VALUES(:userid, :username, :hash, :salt, :email, :fullname, :address, :postcode, :age, :bio, :admin, NULL, 0, 0, 0)";
     $stmt = $this->pdo->prepare($query);
     $userid = $user->getUserId();
     $username = $user->getUsername();
     $hash = $user->getHash();
     $salt = $user->getSalt();
     $email = $user->getEmail();
     $age = $user->getAge();
     $bio = $user->getBio();
     $admin = $user->isAdmin();
     $fullname = $user->getFullname();
     $address = $user->getAddress();
     $postcode = $user->getPostcode();
     $stmt->bindParam(':userid', $userid);
     $stmt->bindParam(':username', $username);
     $stmt->bindParam(':hash', $hash);
     $stmt->bindParam(':salt', $salt);
     $stmt->bindParam(':email', $email);
     $stmt->bindParam(':age', $age);
     $stmt->bindParam(':bio', $bio);
     $stmt->bindParam(':admin', $admin);
     $stmt->bindParam(':fullname', $fullname);
     $stmt->bindParam(':address', $address);
     $stmt->bindParam(':postcode', $postcode);
     return $stmt->execute();
 }