Subversion Repository Public Repository

Nextrek

Diff Revisions 242 vs 281 for /Android/SmartCharging/endPoints/UserRepository.php

Diff revisions: vs.
  @@ -27,13 +27,12 @@
27 27
28 28 $hashedPwd = password_hash($password, PASSWORD_DEFAULT);
29 29
30 - $query = "INSERT INTO utente(username, password, nominativo, cell, email, avatar, is_owner)
30 + $query = "INSERT INTO utente(username, password, nominativo, cell, email, is_owner)
31 31 VALUES ('".$user->username."',
32 32 '".$hashedPwd."',
33 33 '".$user->nominativo."',
34 34 '".$user->cell."',
35 35 '".$user->email."',
36 - '".$user->avatar."',
37 36 '".$user->is_owner."')";
38 37
39 38 //echo "<br/>".$query."<br/>";
  @@ -66,6 +65,26 @@
66 65 return ($result->fetchColumn() == "0");
67 66 }
68 67
68 + public function setAvatar($user_id, $avatar_url) {
69 + $status = array();
70 +
71 + try {
72 + $query = "UPDATE utente
73 + SET avatar='".$avatar_url."'
74 + WHERE id=".$user_id;
75 +
76 + $this->db->exec($query);
77 + $status["return"] = 0;
78 + $status["avatar_path"] = $avatar_url;
79 + return $status;
80 + } catch (PDOException $e) {
81 + echo $e->getMessage();
82 + $status["return"] = 1;
83 + $status["avatar_path"] = "";
84 + return $status;
85 + }
86 + }
87 +
69 88 }
70 89
71 90 ?>