From 891f9931e04ab874748a64688ea279ebf337ce9a Mon Sep 17 00:00:00 2001 From: rosiana Date: Tue, 14 Oct 2014 16:44:27 +0700 Subject: [PATCH 1/4] first commit --- assets/js/alert.js | 1 + index.php | 101 +++++++++++++++++++++++++++++++ mysql.php | 22 +++++++ new_post.php | 108 +++++++++++++++++++++++++++++++++ post.php | 146 +++++++++++++++++++++++++++++++++++++++++++++ submit.php | 10 ++++ 6 files changed, 388 insertions(+) create mode 100644 assets/js/alert.js create mode 100644 index.php create mode 100644 mysql.php create mode 100644 new_post.php create mode 100644 post.php create mode 100644 submit.php diff --git a/assets/js/alert.js b/assets/js/alert.js new file mode 100644 index 0000000..15cba4b --- /dev/null +++ b/assets/js/alert.js @@ -0,0 +1 @@ +// JavaScript source code diff --git a/index.php b/index.php new file mode 100644 index 0000000..963ea5d --- /dev/null +++ b/index.php @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
+ + + +
+ + + '; + } +} + +?> + + + +
+ + + \ No newline at end of file diff --git a/mysql.php b/mysql.php new file mode 100644 index 0000000..b443fd3 --- /dev/null +++ b/mysql.php @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
+ + + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+
+ + + + + + +
+ + + +
+
+
+
+ +
+ + + +
+ + alert("Post submitted.");'; + else + echo mysql_error(); + } +?> + + + \ No newline at end of file diff --git a/post.php b/post.php new file mode 100644 index 0000000..194543e --- /dev/null +++ b/post.php @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | '.$row['title'].' + + + +
+ + + +
+ +
+
+ +

'.$row['title'].'

+

+
+
+ +
+
+
+

'.$row['content'].'

'; +echo '
'; +echo '

Komentar

'; + +$result = mysql_safe_query('SELECT * FROM comments WHERE post_id=%s ORDER BY date ASC', $_GET['id']); +echo '
    '; +while($row = mysql_fetch_assoc($result)) { + echo '
  1. '; + echo (empty($row['website'])?''.$row['name'].'':''.$row['name'].''); + echo ' (Delete)
    '; + echo ''.date('j-M-Y g:ia', $row['date']).'
    '; + echo nl2br($row['content']); + echo '
  2. '; +} +echo ''; + +

    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/submit.php b/submit.php new file mode 100644 index 0000000..8bc19b2 --- /dev/null +++ b/submit.php @@ -0,0 +1,10 @@ + alert("Post submitted.");'; + else + echo mysql_error(); + } +?> \ No newline at end of file From 5b2d12219a713f9e6fffec6d7d23d8f565e33222 Mon Sep 17 00:00:00 2001 From: rosiana Date: Tue, 14 Oct 2014 17:59:51 +0700 Subject: [PATCH 2/4] view post error --- index.php | 2 +- post.php | 94 ++++++++++++++++++++++--------------------------------- 2 files changed, 38 insertions(+), 58 deletions(-) diff --git a/index.php b/index.php index 963ea5d..e2631aa 100644 --- a/index.php +++ b/index.php @@ -60,7 +60,7 @@
  • -

    '.$row['title'].'

    +

    '.$row['title'].'

    '.$row['date'].'
    Featured
    diff --git a/post.php b/post.php index 194543e..c1a1a55 100644 --- a/post.php +++ b/post.php @@ -28,25 +28,23 @@ - + + +
    Simple Blog | '.$row['title'].' - - - -
    - -
    '; +?> @@ -136,11 +116,11 @@ / / / - +
    - \ No newline at end of file + From 7027cd349f680a27ab540b3842516d9a7a23f250 Mon Sep 17 00:00:00 2001 From: Rosi Lutfiana Date: Tue, 14 Oct 2014 18:47:22 +0700 Subject: [PATCH 3/4] Update post.php line 87 --- post.php | 1 - 1 file changed, 1 deletion(-) diff --git a/post.php b/post.php index c1a1a55..bbee0b7 100644 --- a/post.php +++ b/post.php @@ -84,7 +84,6 @@
'; $result = mysql_safe_query('SELECT * FROM comment WHERE post_id=%s ORDER BY date ASC', $_GET['id']); -
    '; while($row = mysql_fetch_assoc($result)) { echo ' - '; - } -} - + + + '; + } +} + if (isset($_GET['delete'])) + { + mysql_safe_query("DELETE FROM post WHERE id = $_GET[delete]"); + } + $result = mysql_safe_query('SELECT * FROM post'); ?> - - + \ No newline at end of file