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(); + + } + } + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
+ + + +
+ + + +

-

+ +
+
+

Tambah Post

+ +
+
+ + + + + + +
+ + + + + +
+
+
+
+ + + +
+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 07cff0b..0000000 --- a/index.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
- - - -
-
- -
-
- - - -
- - - - - - - - \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..f341adf --- /dev/null +++ b/index.php @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + +prepare("DELETE FROM `simpelblok`.`post` WHERE `post`.`ID` = ?"); + $stm->bindParam(1, $_POST["del"]); + $stm->execute(); +} + + +$stm = $dbh->prepare("SELECT * FROM post"); +$stm->execute(); + +?> + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/komen.php b/komen.php new file mode 100644 index 0000000..defc910 --- /dev/null +++ b/komen.php @@ -0,0 +1,38 @@ +prepare("SELECT * FROM komen WHERE PostID=?"); + $comm->bindParam(1, $_GET["id"]); + $comm->execute(); + } else /*if(isset($_POST["Nama"]) && isset($_POST["Email"]) && isset($_POST["Komentar"]) && isset($_POST["postid"]))*/ { + $commb = $dbh->prepare("INSERT INTO `simpelblok`.`komen` (`ID`, `PostID`, `Nama`, `Email`, `Tanggal`, `Isi`) VALUES (NULL, :id, :nama, :email, :tanggal, :komentar);"); + $commb->bindParam(":nama", $_POST["Nama"]); + $commb->bindParam(":email", $_POST["Email"]); + $date = date('Y-m-d'); + $commb->bindParam(":tanggal", $date); + $commb->bindParam(":komentar", $_POST["Komentar"]); + $commb->bindParam(":id", $_POST["postid"]); + $commb->execute(); + $comm = $dbh->prepare("SELECT * FROM komen WHERE PostID=?"); + $comm->bindParam(1, $_POST["postid"]); + $comm->execute(); + } +?> + + + + + \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..b652f77 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_55 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..e7d12e5 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + Simple Blog + + + diff --git a/post.html b/post.html deleted file mode 100644 index c0b6f9e..0000000 --- a/post.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog | Apa itu Simple Blog? - - - - - -
- - - -
- -
-
- -

Apa itu Simple Blog?

-

-
-
- -
-
-
-

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?

- -
- -

Komentar

- -
-
- - - - - - -
- - - -
-
- -
    -
  • -
    -

    Jems

    -
    2 menit lalu
    -
    -

    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! …

    -
  • - -
  • -
    -

    Kave

    -
    1 jam lalu
    -
    -

    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! …

    -
  • -
-
-
- -
- - - -
- - - - - - - - \ No newline at end of file diff --git a/new_post.html b/post.php similarity index 50% rename from new_post.html rename to post.php index fc4e18e..bf7c973 100644 --- a/new_post.html +++ b/post.php @@ -1,6 +1,21 @@ + + prepare("SELECT * FROM post WHERE ID=?"); + $view->bindParam(1, $_GET["id"]); + $view->execute(); + $row = $view->fetch(PDO::FETCH_ASSOC); + $judul = $row['Judul']; + $tanggal = $row['Tanggal']; + $konten = $row['Konten']; + + + + ?> @@ -29,7 +44,7 @@ -Simple Blog | Tambah Post +Simple Blog | Apa itu Simple Blog? @@ -38,7 +53,7 @@