August 2016
Intermediate to advanced
286 pages
5h 31m
English
articles.php 1 <?php 2 require "includes/setup.php"; 3 4 $user_id = $user->getId(); 5 6 $db = new Database($db_host, $db_user, $db_pass); 7 $articles_gateway = new ArticlesGateway($db); 8 $users_gateway = new UsersGateway($db); 9 $article_transactions = new ArticleTransactions( 10 $articles_gateway, 11 $users_gateway 12 ); 13 14 $id = isset($_GET['id']) ? $_GET['id'] : 0; 15 if ($id) { 16 $article_transactions->updateExistingArticle($user_id, $_POST); 17 } else { 18 $article_transactions->submitNewArticle($user_id, $_POST); 19 } 20 21 $failure = $article_transactions->getFailure(); 22 $input = $article_transactions->getInput(); 23 $action = $_SERVER['PHP_SELF']; 24 25 /** PRESENTATION */ 26 ...Read now
Unlock full access