header('Location: index.php?action=register'); $_SESSION['success'] = "Sorry! the registration failed"; } } } } else { if (isset($_POST['editarticle'])) { $posttitle = $_POST['posttitle']; $postdescription = $_POST['postdescription']; $postcategory = $_POST['postcategory']; $postmetatag = $_POST['postmetatag']; $postid = isset($_GET['id']) ? $_GET['id'] : ''; //var_dump($posttitle,$postid);die; $query = "UPDATE article SET posttitle='{$posttitle}', postdescription='{$postdescription}', postcategory='{$postcategory}',postmetatag='{$postmetatag}'\n WHERE postid='{$postid}' "; $article = new Article(); $result = $article->editarticle($query); if ($result) { header('Location: index.php?action=listpost'); $_SESSION['success'] = "The Post has been sucessfully Updated"; } else { header('Location: index.php?action=editpost'); $_SESSION['error'] = "sorry! there was an error while updating"; } } else { if (isset($_POST['editprofile'])) { $tmp_name = $_FILES["avatar"]["tmp_name"]; $name = $_FILES["avatar"]["name"]; //var_dump($name);die; move_uploaded_file($tmp_name, "uploads/{$name}"); $id = $_SESSION['userid']; $user = new User();