Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nbproject/private/
14 changes: 11 additions & 3 deletions assets/css/screen.css
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -225,15 +232,15 @@ div.cover > img {
}
/* Header */
.art-header {
height: 900px;
height: 500px;
/* Background image is defined in the post */
background-position: top center;
background-attachment: fixed;
overflow: hidden;
}
/* Contains the time, title and subtitle for an article */
.art-header-inner {
position: fixed;
position: relative;
top: 300px;
left: 50%;
margin-left: -490px;
Expand Down Expand Up @@ -274,6 +281,7 @@ div.cover > img {
/* Body */
.art-body {
position: relative;
top: 40px;
width: 100%;
background: #fff;
z-index: 100;
Expand Down Expand Up @@ -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;
Expand Down
46 changes: 46 additions & 0 deletions assets/js/ajax.js
Original file line number Diff line number Diff line change
@@ -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;
}
171 changes: 171 additions & 0 deletions editor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">
function checkdate(){
var input = document.getElementById('Tanggal');
var validformat=/^\d{4}\-\d{2}\-\d{2}$/; //Basic check for format validity
var returnval=false;
if (!validformat.test(input.value)) {
alert("Invalid Date Format. Please correct and submit again.");
} else { //Detailed check for valid date ranges
var yearfield=input.value.split("-")[0];
var monthfield=input.value.split("-")[1];
var dayfield=input.value.split("-")[2];
var enteredDate = new Date(yearfield, monthfield-1, dayfield);
var today = new Date();
if (enteredDate.setHours(0,0,0,0) < today.setHours(0,0,0,0)) {
alert("Invalid date. The day you entered is before today");
} else {
returnval=true;
}
}
return returnval;
}
</script>
<?php

$judul = "";
$konten = "";
$initID = -1;

if(isset($_GET['id'])) {
$dbh = new PDO("mysql:dbname=simpelblok;host=localhost", "simpelblok", "simpelblok");
$test = $dbh->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();

}
}

?>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="Deskripsi Blog">
<meta name="author" content="Judul Blog">

<!-- Twitter Card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="omfgitsasalmon">
<meta name="twitter:title" content="Simple Blog">
<meta name="twitter:description" content="Deskripsi Blog">
<meta name="twitter:creator" content="Simple Blog">
<meta name="twitter:image:src" content="{{! TODO: ADD GRAVATAR URL HERE }}">

<meta property="og:type" content="article">
<meta property="og:title" content="Simple Blog">
<meta property="og:description" content="Deskripsi Blog">
<meta property="og:image" content="{{! TODO: ADD GRAVATAR URL HERE }}">
<meta property="og:site_name" content="Simple Blog">

<link rel="stylesheet" type="text/css" href="assets/css/screen.css" />
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<title>Simple Blog | Tambah Post</title>


</head>

<body class="default">
<div class="wrapper">

<nav class="nav">
<a style="border:none;" id="logo" href="index.php"><h1>Simple<span>-</span>Blog</h1></a>
<ul class="nav-primary">
<li><a href="editor.php">+ Tambah Post</a></li>
</ul>
</nav>

<article class="art simple post">



<h2 class="art-title" style="margin-bottom:40px">-</h2>

<div class="art-body">
<div class="art-body-inner">
<h2>Tambah Post</h2>

<div id="contact-area">
<form method="post" action="editor.php" onsubmit="return checkdate()" >
<label for="Judul">Judul:</label>
<input type="text" name="Judul" id="Judul" value="<?php echo $judul; ?>">

<label for="Tanggal">Tanggal:</label>
<input type="text" name="Tanggal" id="Tanggal">

<label for="Konten">Konten:</label><br>
<textarea name="Konten" rows="20" cols="20" id="Konten"><?php echo $konten; ?></textarea>

<input name="id" type="hidden" value="<?php echo $initID ?>">

<input type="submit" name="submit" value="Simpan" class="submit-button">
</form>
</div>
</div>
</div>

<script>
var date = new Date();
document.getElementById("Tanggal").setAttribute("value", date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate());
</script>

</article>

<footer class="footer">
<div class="back-to-top"><a href="">Back to top</a></div>
<!-- <div class="footer-nav"><p></p></div> -->
<div class="psi">&Psi;</div>
<aside class="offsite-links">
Asisten IF3110 /
<a class="rss-link" href="#rss">RSS</a> /
<br>
<a class="twitter-link" href="http://twitter.com/YoGiiSinaga">Yogi</a> /
<a class="twitter-link" href="http://twitter.com/sonnylazuardi">Sonny</a> /
<a class="twitter-link" href="http://twitter.com/fathanpranaya">Fathan</a> /
<br>
<a class="twitter-link" href="#">Renusa</a> /
<a class="twitter-link" href="#">Kelvin</a> /
<a class="twitter-link" href="#">Yanuar</a> /

</aside>
</footer>

</div>

<script type="text/javascript" src="assets/js/fittext.js"></script>
<script type="text/javascript" src="assets/js/app.js"></script>
<script type="text/javascript" src="assets/js/respond.min.js"></script>



</body>
</html>
114 changes: 0 additions & 114 deletions index.html

This file was deleted.

Loading