August 2016
Intermediate to advanced
286 pages
5h 31m
English
articles.php 1 <?php 2 require "includes/setup.php"; 3 4 $current_page = 'articles'; 5 6 include "header.php"; 7 8 $id = isset($_GET['id']) ? $_GET['id'] : 0; 9 if ($id) { 10 $page_title = "Edit An Article"; 11 } else { 12 $page_title = "Submit An Article"; 13 } 14 15 ?><h1><?php echo $page_title ?></h1><?php 16 17 $user_id = $user->getId(); 18 19 $db = new Database($db_host, $db_user, $db_pass); 20 $articles_gateway = new ArticlesGateway($db); 21 $users_gateway = new UsersGateway($db); 22 $article_transactions = new ArticleTransactions( 23 $articles_gateway, 24 $users_gateway 25 ); 26 27 if ($id) { 28 $article_transactions->updateExistingArticle($user_id, $_POST); 29 } else { 30 $article_transactions->submitNewArticle($user_id, ...Read now
Unlock full access