Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Udah nih udah kok.. insya allah udah #102

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions EditShow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
echo $_POST['Judul'];
echo $_POST['Tanggal'];
echo $_POST['Content'];
?>
22 changes: 22 additions & 0 deletions ajax_addcomment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

if (isset($_GET['nama']) && isset($_GET['email']) && isset($_GET['konten'])) {
$host = "localhost";
$username = "root";
$password = "";
$dbname = "if3110-01";

$id_post = $_GET['id_post'];
$nama = $_GET['nama'];
$email = $_GET['email'];
$waktu = date('Y-m-d H:i:s');
$konten = $_GET['konten'];
$conection = mysqli_connect($host,$username,$password,$dbname);
$query = "INSERT INTO komentar (`id_post`,`nama`,`email`,`waktu`,`konten`) Values ('$id_post','$nama','$email','$waktu','$konten')";
if (!mysqli_query($conection,$query)) {
echo '{"status":"error"}';
}else{
echo '{"status":"ok"}';
}
}
?>
23 changes: 23 additions & 0 deletions ajax_loadcomment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
if(isset($_GET['id_post'])){
$host = "localhost";
$username = "root";
$password = "";
$dbname = "if3110-01";

$conection = mysqli_connect($host,$username,$password,$dbname);
$query = "SELECT * from komentar where id_post=".$_GET['id_post'];
$result = mysqli_query($conection,$query);
$json = array();
while ($row = mysqli_fetch_array($result)) {
$json[] = array(
'id_komentar' => $row['id_komentar'],
'nama' => $row['nama'],
'email' => $row['email'],
'waktu' => $row['waktu'],
'konten' => $row['konten'],
);
}
echo json_encode($json);
}
?>
14 changes: 14 additions & 0 deletions deletepost.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
if (isset($_GET['action']) && ($_GET['action'] == 'delete') && isset($_GET['id_post'])) {
$host = "localhost";
$username = "root";
$password = "";
$dbname = "if3110-01";

$conection = mysqli_connect($host,$username,$password,$dbname);
$query = "DELETE from post where id_post=".$_GET['id_post'];
mysqli_query($conection, $query);
mysqli_close($conection);
header('Location: http://localhost/if3110-01-Simple-blog/index.php');
}
?>
14 changes: 14 additions & 0 deletions includes/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

$host = "localhost";
$username = "root";
$password = "";
$dbname = "if3110-01";

$conection = mysqli_connect($host,$username,$password,$dbname);

if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

?>
78 changes: 78 additions & 0 deletions includes/utama.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
(function() {
var onDomReadyIdentifier = 'onDomReady';
var isBound = false;
var readyList = [];
if (window[onDomReadyIdentifier] && typeof window[onDomReadyIdentifier] == 'function') {
return;
}
var whenReady = function() {
// Make sure body exists, at least, in case IE gets a little overzealous.
// This is taked directly from jQuery's implementation.
if (!document.body) {
return setTimeout(whenReady, 13);
}
for (var i=0; i<readyList.length; i++) {
readyList[i]();
}
readyList = [];
};
var bindReady = function() {
// Mozilla, Opera and webkit nightlies currently support this event
if (document.addEventListener) {
var DOMContentLoaded = function() {
document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);
whenReady();
};
document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
window.addEventListener("load", whenReady, false); // fallback
// If IE event model is used
} else if (document.attachEvent) {
var onreadystatechange = function() {
if (document.readyState === "complete") {
document.detachEvent("onreadystatechange", onreadystatechange);
whenReady();
}
};
document.attachEvent("onreadystatechange", onreadystatechange);
window.attachEvent("onload", whenReady); // fallback
// If IE and not a frame, continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
// The DOM ready check for Internet Explorer
if (document.documentElement.doScroll && toplevel) {
var doScrollCheck = function() {
// stop searching if we have no functions to call
// (or, in other words, if they have already been called)
if (readyList.length == 0) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout(doScrollCheck, 1);
return;
}
// and execute any waiting functions
whenReady();
}
doScrollCheck();
}
}
};
window[onDomReadyIdentifier] = function(callback) {
// Push the given callback onto the list of functions to execute when ready.
// If the dom has alredy loaded, call 'whenReady' right away.
// Otherwise bind the ready-event if it hasn't been done already
readyList.push(callback);
if (document.readyState == "complete") {
whenReady();
} else if (!isBound) {
bindReady();
isBound = true;
}
};
})();
120 changes: 120 additions & 0 deletions index.old.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>

<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</title>


</head>

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

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

<div id="home">
<div class="posts">
<nav class="art-list">
<ul class="art-list-body">
<?php
$host = "localhost";
$username = "root";
$password = "";
$dbname = "if3110-01";

$conection = mysqli_connect($host,$username,$password,$dbname);

if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($conection, "SELECT * from post");
while($row = mysqli_fetch_array($result)){
echo '<li class="art-list-item">';
echo '<div class="art-list-item-title-and-time">';
echo ' <h2 class="art-list-title"><a href="post.php?id_post='.$row['id_post'].'">'.$row['judul'].'</a></h2>';
echo ' <div class="art-list-time">'.$row['tanggal'].'</div>';
echo ' <div class="art-list-time"><span style="color:#F40034;">&#10029;</span> Featured</div>';
echo '</div>';
echo '<p>'.$row['konten'].'&hellip;</p>';
echo '<p>';
echo '<a href="#">Edit</a> | <a href="#">Hapus</a>';
echo '</p>';
echo '</li>';
}
?>
</ul>
</nav>
</div>
</div>

<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/jquery.min.js"></script>
<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>
<script type="text/javascript">
var ga_ua = '{{! TODO: ADD GOOGLE ANALYTICS UA HERE }}';

(function(g,h,o,s,t,z){g.GoogleAnalyticsObject=s;g[s]||(g[s]=
function(){(g[s].q=g[s].q||[]).push(arguments)});g[s].s=+new Date;
t=h.createElement(o);z=h.getElementsByTagName(o)[0];
t.src='//www.google-analytics.com/analytics.js';
z.parentNode.insertBefore(t,z)}(window,document,'script','ga'));
ga('create',ga_ua);ga('send','pageview');
</script>

</body>
</html>
Loading