diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14bc68c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/nbproject/private/ \ No newline at end of file diff --git a/assets/css/screen.css b/assets/css/screen.css index 1d8fdf3..01a5587 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -1,6 +1,13 @@ @import url(http://fonts.googleapis.com/css?family=Open+Sans); @import url(http://fonts.googleapis.com/css?family=Questrial); + +form.hidden{ + display: none; +} + + + /* Reset & Basics (Inspired by E. Meyers) ================================================== */ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { @@ -225,7 +232,7 @@ div.cover > img { } /* Header */ .art-header { - height: 900px; + height: 500px; /* Background image is defined in the post */ background-position: top center; background-attachment: fixed; @@ -233,7 +240,7 @@ div.cover > img { } /* Contains the time, title and subtitle for an article */ .art-header-inner { - position: fixed; + position: relative; top: 300px; left: 50%; margin-left: -490px; @@ -274,6 +281,7 @@ div.cover > img { /* Body */ .art-body { position: relative; + top: 40px; width: 100%; background: #fff; z-index: 100; @@ -815,7 +823,7 @@ hr.featured-article { text-align: center; } hr.featured-article:after { - content: "✭ Featured Article ✭"; + content: "✭ FEATURED ARTICLE ✭"; display: inline-block; position: relative; top: -0.8em; diff --git a/assets/js/ajax.js b/assets/js/ajax.js new file mode 100644 index 0000000..f22e3ea --- /dev/null +++ b/assets/js/ajax.js @@ -0,0 +1,46 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + + +var xmlhttp; +function ajaxGET(url,cfunc) { // Ajax Processor (not to be called from HTML) + xmlhttp=new XMLHttpRequest(); + xmlhttp.onreadystatechange=cfunc; + xmlhttp.open("GET",url,true); + xmlhttp.send(); + return xmlhttp; +} +function ajaxPOST(url,data,cfunc) { // Ajax Processor (not to be called from HTML) + xmlhttp=new XMLHttpRequest(); + xmlhttp.onreadystatechange=cfunc; + xmlhttp.open("POST",url,true); + xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + xmlhttp.send(data); + return xmlhttp; +} +function loadPage(url,eid) { // Ajax LoadPage Handler + ajaxGET(url,function(){ + if (xmlhttp.readyState===4 && xmlhttp.status===200) { + document.getElementById([eid]).innerHTML=xmlhttp.responseText; + } + }); +} + +function postComment(form,url,eid) { // Ajax LoadPage Handle + var input = document.getElementById("Email"); + var validformat=/^\S*@\S*\.\S*$/; //Basic check for format validity + if (!validformat.test(input.value)) { + alert("Invalid Email Format. Please correct and submit again."); + } else { + var data = "Nama=" + form.Nama.value + "&Email=" + form.Email.value + "&postid=" + form.postid.value + "&Komentar=" + form.Komentar.value; + ajaxPOST(url, data, function(){ + if (xmlhttp.readyState===4 && xmlhttp.status===200) { + document.getElementById([eid]).innerHTML=xmlhttp.responseText; + } + }); + } + return false; +} \ No newline at end of file diff --git a/editor.php b/editor.php new file mode 100644 index 0000000..d496682 --- /dev/null +++ b/editor.php @@ -0,0 +1,171 @@ + + +
+ + + prepare("SELECT * FROM post WHERE ID=?"); + $test->bindParam(1, $_GET["id"]); + $test->execute(); + $row = $test->fetch(PDO::FETCH_ASSOC); + $judul = $row['Judul']; + $konten = $row['Konten']; + $initID = $row['ID']; + } + + if(isset($_POST["Judul"]) && isset($_POST["Tanggal"]) && isset($_POST["Konten"]) && isset($_POST["id"])) { + $dbh = new PDO("mysql:dbname=simpelblok;host=localhost", "simpelblok", "simpelblok"); + if($_POST["id"] == -1) { + $tes = $dbh->prepare("INSERT INTO `simpelblok`.`post` (`ID`, `Judul`, `Tanggal`, `Konten`) VALUES (NULL, ?, ?, ?);"); + $tes->bindParam(1, $_POST["Judul"]); + $tes->bindParam(2, $_POST["Tanggal"]); + $tes->bindParam(3, $_POST["Konten"]); + $tes->execute(); + } else { + $edit = $dbh->prepare("UPDATE `simpelblok`.`post` SET `Judul` = :judul, `Tanggal` = :tanggal, `Konten` = :konten WHERE `post`.`ID` = :id;"); + $edit->bindParam(':judul', $_POST["Judul"]); + $edit->bindParam(':tanggal', $_POST["Tanggal"]); + $edit->bindParam(':konten', $_POST["Konten"]); + $edit->bindParam(':id', $_POST["id"]); + $edit->execute(); + + } + } + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.
-Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?
- -Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …
-Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …
-