<?php

session_start();
require_once '../config/dbconf.php';
require_once '../model/articles.php';
require_once '../model/commentarySql.php';
$article = new ArticleDisp();
$data = $article->articlePageDisplay($pdo);
$result = new CommentDisplay();
$disp = $result->displayComment($pdo);
$idCom = $result->selectCommentId($pdo);
$errors = '';
$isFormGood = true;
//New commentary
if (isset($_POST['commentary'])) {
    $new = new Comment();
    if (!isset($_POST['commentary']) || strlen($_POST['commentary']) < 10) {
        $errors = 'Please make sure your comment is not under 10 chars';
        $isFormGood = false;
    }
    if (empty($_SESSION['login'])) {
        $errors = 'Connect before post a comment';
        $isFormGood = false;
    }
    if (!$isFormGood) {
        http_response_code(400);
        echo json_encode(array('success' => false, "errors" => $errors));
    } else {
        $new->newComment($pdo);
        echo json_encode(array('success' => true, "user" => $_POST));
    }
<?php

require_once '../config/dbconf.php';
require_once '../model/articles.php';
session_start();
// Article list
$test = new ArticleDisp();
$articleTitle = $test->idDisplay($pdo);
$articleDetail = $test->articleDetailDisplay($pdo);
<?php

session_start();
require_once '../config/dbconf.php';
require_once '../model/articles.php';
require_once '../model/commentarySql.php';
require_once '../model/profilDisplaySql.php';
$back = new ArticleDisp();
$data = $back->displayArticle($pdo);
$result = new CommentDisplay();
$disp = $result->displayComment($pdo);
$idCom = $result->selectCommentId($pdo);
<?php

require_once '../config/dbconf.php';
require_once '../model/articles.php';
session_start();
$errors = array();
$updateOk = true;
$errormessage = '';
$isFormGood = true;
$new = new ArticleDisp();
$disp = $new->articleEditDisplay($pdo);
if (isset($_POST['title'])) {
    $new = new ArticleEdit();
    if (empty($_POST["title"]) || strlen($_POST['title']) < 10) {
        $errormessage = "Please put a title or your title is under 10 characters";
        $isFormGood = false;
    }
    if (empty($_POST["content"]) || strlen($_POST['content']) < 100) {
        $errormessage = 'Your article is under 100 characters';
        $isFormGood = false;
    }
    if (empty($_POST["shortContent"]) || strlen($_POST['shortContent']) < 30) {
        $errormessage = 'Your description is under 30 characters';
        $isFormGood = false;
    }
    if (!$isFormGood) {
        http_response_code(400);
        echo json_encode(array('success' => false, "errors" => $errormessage));
    } else {
        $new->updateArticle($pdo);
        echo json_encode(array('success' => true, "user" => $_POST));