Beispiel #1
0
 function register($login, $pass, $mail, $prenom, $nom, $city, $birthday)
 {
     $connexion = \App\Model\Database::get()->prepare("\n\t\t\tINSERT INTO tp_users\n\t\t\t(email,login,password,first_name,last_name,city,birthday,register_date)\n\t\t\tVALUE ( '" . $mail . "',  '" . $login . "', '" . $pass . "', '" . $prenom . "', '" . $nom . "','" . $city . "','" . $birthday . "', NOW()  )");
     $connexion->execute();
     echo "true";
     //Ajax
 }
Beispiel #2
0
 function ReadMessage()
 {
     $connexion = \App\Model\Database::get()->prepare("SELECT * FROM `tp_messages` INNER JOIN tp_users on tp_users.id = expediteur_id   WHERE expediteur_id = '" . $_SESSION["id"] . "'");
     $connexion->execute();
     $data = $connexion->fetchAll();
     return $data;
 }
Beispiel #3
0
 function User($login, $pass)
 {
     $connexion = \App\Model\Database::get()->prepare("\n\t\t\tSELECT * from tp_users\n\t\t\tWHERE (login = '******'\n\t\t\tOR email = '" . $login . "')\n\t\t\tAND password = '******'\n\t\t");
     $connexion->execute();
     $data = $connexion->fetchAll();
     return $data;
 }
Beispiel #4
0
 function Mefollower()
 {
     $connexion = \App\Model\Database::get()->prepare("\n\t\t\tSELECT *,count(follow_id) AS nbrFollow\n\t\t\tFROM `tp_follow` INNER JOIN tp_users\n\t\t\tON tp_follow.follower_id = tp_users.id\n\t\t\tWHERE follow_id = '" . $this->id . "'");
     $connexion->execute();
     $data = $connexion->fetchAll();
     return $data;
 }
Beispiel #5
0
 public function readTweet($id)
 {
     $connexion = \App\Model\Database::get()->prepare("SELECT * from tp_follow  INNER JOIN tp_users on tp_users.id = tp_follow.follow_id INNER JOIN tp_tweets on  tp_users.id  =  tp_tweets.user_id  WHERE follower_id = '" . $id . "' OR follow_id = '" . $id . "' GROUP BY tp_tweets.id");
     $connexion->execute();
     $data = $connexion->fetchAll();
     return $data;
 }
Beispiel #6
0
 function allSearch($data)
 {
     $connexion = \App\Model\Database::get()->prepare("SELECT * FROM tp_tweets INNER JOIN tp_users ON tp_tweets.user_id = tp_users.id\n\t\t\tWHERE login LIKE '%" . $data . "%' OR content like '%" . $data . "%'");
     $connexion->execute();
     $data = $connexion->fetchAll();
     $tab = ["type" => "*"];
     $type = array_merge($tab, $data);
     return $type;
 }
Beispiel #7
0
 /**
  * Crée un nouvel élément dans le tableau
  * @param array $fieldArray contient les infos à créer ['champ' => 'value']
  */
 public function create($fieldArray = array())
 {
     $fields = '';
     $values = '';
     foreach ($fieldArray as $key => $value) {
         $fields .= "{$key}, ";
         $values .= "'{$value}', ";
     }
     $fields = substr($fields, 0, -2);
     $values = substr($values, 0, -2);
     $sql = "INSERT INTO {$this->table} ({$fields}) VALUES ({$values})";
     $req = Database::get()->prepare($sql);
     $req->execute();
 }
Beispiel #8
0
 function SendMessage($content, $dest, $exp)
 {
     $connexion = \App\Model\Database::get()->prepare("INSERT INTO tp_messages\n\t\t\t(content,destinataire_id,expediteur_id,date)\n\t\t\tVALUE('" . $content . "','" . $dest . "','" . $exp . "',NOW()) ");
     $connexion->execute();
 }
Beispiel #9
0
 function addFollowSQL($follow)
 {
     $connexion = \App\Model\Database::get()->prepare("\n\t\t\tINSERT INTO tp_follow (follow_id,follower_id)\n\t\t\tVALUES ('" . $follow . "','" . $_SESSION["id"] . "') ");
     $connexion->execute();
 }