Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function index($request,$context){
- context::setSessionAttribute("nb_tweet_init", tweetTable::countTweet());
- $context->title = "Index";
- if(context::getSessionAttribute("connect") != "true"){
- context::redirect("goater.php?action=login");
- }
- $bdd = new PDO('pgsql:host=localhost dbname=etd user=uapv1402577 password=jenYv1'); // Utilisation de cette connexion au lieu de dbconnection() pour l'utilisation du fetchColumn();
- $id = context::getSessionAttribute("id");
- $user = utilisateurTable::getUserById($id)[0];
- context::setSessionAttribute("id",$user->id);
- context::setSessionAttribute("nom",$user->nom);
- context::setSessionAttribute("prenom",$user->prenom);
- context::setSessionAttribute("identifiant",$user->identifiant);
- context::setSessionAttribute("statut",$user->statut);
- context::setSessionAttribute("avatar",$user->avatar);
- context::setSessionAttribute("nb_tweet",$bdd -> query("SELECT COUNT (*) from jabaianb.tweet where emetteur=$user->id")->fetchColumn());
- if(isset($request["tweet"])){
- tweetTable::sendTweet($request["tweet"]);
- }
- return context::SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement