예제 #1
0
if (isset($_GET['user']) && $_GET['user'] != $_SESSION['username']) {
    $profil_userid = $_GET['user'];
    $profil_user = InfoUser::getInstance($DB_con, $profil_userid);
} else {
    /* Sinon si c'est le notre */
    $profil_user = InfoUser::getInstance($DB_con, $_SESSION['username']);
}
/* On récupère ensuite les infos */
$info_profil = $profil_user->getInfo();
$follow = Follow::getInstance($DB_con, $info_profil->id);
if (isset($_POST['SubmitFollow'])) {
    $UserToFollow = htmlspecialchars(trim($_POST['ProfilUserid']));
    if (!empty($UserToFollow)) {
        $follow->Follow();
    }
}
if (isset($_POST['SubmitUnFollow'])) {
    $UserToFollow = htmlspecialchars(trim($_POST['ProfilUserid']));
    if (!empty($UserToFollow)) {
        $follow->UnFollow();
    }
}
$nbrTweets = $profil_user->getNbrTweets();
$nbrFollowers = $profil_user->getNbrFollowers();
$nbrFollow = $profil_user->getNbrFollow();
$nbrMedia = $profil_user->getNbrMedia();
$user = User::getInstance($DB_con);
$imgprofil = $user->getUserImg($info_profil->id);
$banniere = $info_profil->banniere;
//On importe la vue
require Config::get('view.paths') . 'profil.view.php';
예제 #2
0
<?php

use App\App;
use App\Vendor\User;
use Core\Config;
require 'core/init.php';
/* On déconnecte l'utilisateur */
User::logout();
//On défini le titre
App::setTitle('Déconnexion');
$id_page = "logout";
//On importe la vue
require Config::get('view.paths') . 'deconnexion.view.php';
예제 #3
0
    $encoding = 'utf-8';
    $username = htmlspecialchars(trim($_POST['InputUsername']), ENT_QUOTES, $encoding);
    $password = htmlspecialchars(trim($_POST['InputPassword']), ENT_QUOTES, $encoding);
    if (isset($_POST['InputStayOnline'])) {
        $stayonline = htmlspecialchars($_POST['InputStayOnline']);
    } else {
        $stayonline = null;
    }
    /* On vérifie que tous les champs sont saisies */
    if (empty($username) || empty($password)) {
        $errors['FieldsEmpty'] = "Veuillez saisir tous les champs de texte";
    }
    /* On vérifie qu'il n'y a pas d'erreurs */
    if ($errors) {
        $allerror = "<ul>";
        foreach ($errors as $key) {
            $allerror .= "<li>" . $key . "</li>";
        }
        $allerror .= "</ul>";
        setFlash($allerror, "danger");
    } else {
        if ($user->login($username, $password, $stayonline)) {
            User::redirect('/');
        } else {
            $errors['LoginFail'] = "Identifiant ou mot de passe incorrect :/";
            setFlash($errors['LoginFail'], "danger");
        }
    }
}
//On importe la vue
require Config::get('view.paths') . 'connexion.view.php';