From 91126f1eed50059188405964e365e142784a4cec Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Tue, 21 Jan 2014 18:29:51 +0700 Subject: [PATCH] Improve the admin panel Improve the admin panel. Use .ini file to store user informations. --- admin/action/create_page.php | 77 ++++++++++++++++++++++++++++++ admin/{includes => action}/create_post.php | 8 +++- admin/action/delete_page.php | 58 ++++++++++++++++++++++ admin/action/delete_post.php | 58 ++++++++++++++++++++++ admin/action/edit_page.php | 75 +++++++++++++++++++++++++++++ admin/{includes => action}/edit_post.php | 7 ++- admin/{includes => action}/login.php | 9 ++-- admin/{includes => action}/logout.php | 2 +- admin/includes/.htaccess | 1 + admin/includes/page_list.php | 42 ++++++++++++++++ admin/includes/post_list.php | 33 ++++++++----- admin/includes/user.php | 10 ++++ admin/index.php | 19 ++++++-- admin/users/username.ini.example | 2 + 14 files changed, 375 insertions(+), 26 deletions(-) create mode 100644 admin/action/create_page.php rename admin/{includes => action}/create_post.php (85%) create mode 100644 admin/action/delete_page.php create mode 100644 admin/action/delete_post.php create mode 100644 admin/action/edit_page.php rename admin/{includes => action}/edit_post.php (86%) rename admin/{includes => action}/login.php (83%) rename admin/{includes => action}/logout.php (63%) create mode 100644 admin/includes/.htaccess create mode 100644 admin/includes/page_list.php create mode 100644 admin/includes/user.php create mode 100644 admin/users/username.ini.example diff --git a/admin/action/create_page.php b/admin/action/create_page.php new file mode 100644 index 0000000..27353d8 --- /dev/null +++ b/admin/action/create_page.php @@ -0,0 +1,77 @@ + + + + + + + + Create page + + + + + + + +
+
+ +
+
+ Url:


+
+
+ +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/admin/includes/create_post.php b/admin/action/create_post.php similarity index 85% rename from admin/includes/create_post.php rename to admin/action/create_post.php index 610bf97..ae7964f 100644 --- a/admin/includes/create_post.php +++ b/admin/action/create_post.php @@ -29,6 +29,9 @@ + + + Create post @@ -41,8 +44,9 @@
diff --git a/admin/action/delete_page.php b/admin/action/delete_page.php new file mode 100644 index 0000000..ef6ebc3 --- /dev/null +++ b/admin/action/delete_page.php @@ -0,0 +1,58 @@ + + + + + + + + Delete page + + + + + + + +
+
+ + + Are you sure want to delete ' . $url . '?

';?> +
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/admin/action/delete_post.php b/admin/action/delete_post.php new file mode 100644 index 0000000..97d30df --- /dev/null +++ b/admin/action/delete_post.php @@ -0,0 +1,58 @@ + + + + + + + + Delete post + + + + + + + +
+
+ + + Are you sure want to delete ' . $url . '?

';?> +
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/admin/action/edit_page.php b/admin/action/edit_page.php new file mode 100644 index 0000000..5690f7a --- /dev/null +++ b/admin/action/edit_page.php @@ -0,0 +1,75 @@ + + + + + + + + Edit page + + + + + + + +
+
+ +
+
+
+
+ +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/admin/includes/edit_post.php b/admin/action/edit_post.php similarity index 86% rename from admin/includes/edit_post.php rename to admin/action/edit_post.php index 69a5787..d62263f 100644 --- a/admin/includes/edit_post.php +++ b/admin/action/edit_post.php @@ -25,6 +25,9 @@ + + + Edit post @@ -38,8 +41,8 @@
diff --git a/admin/includes/login.php b/admin/action/login.php similarity index 83% rename from admin/includes/login.php rename to admin/action/login.php index b16eea9..abea591 100644 --- a/admin/includes/login.php +++ b/admin/action/login.php @@ -1,13 +1,13 @@ + + + Admin Panel diff --git a/admin/includes/logout.php b/admin/action/logout.php similarity index 63% rename from admin/includes/logout.php rename to admin/action/logout.php index eb02529..a91ebe5 100644 --- a/admin/includes/logout.php +++ b/admin/action/logout.php @@ -1,6 +1,6 @@ '; + foreach($posts as $index => $v){ + + echo ''; + echo '' . $v . ''; + echo '
'; + echo '
'; + echo ''; + + } + echo ''; + + } + + +?> \ No newline at end of file diff --git a/admin/includes/post_list.php b/admin/includes/post_list.php index d8e01e5..a61d0d2 100644 --- a/admin/includes/post_list.php +++ b/admin/includes/post_list.php @@ -1,5 +1,8 @@ No posts found!'; + echo '
No posts found!
'; return; } @@ -112,20 +115,24 @@ function get_profile($profile, $page, $perpage){ } -if (isset($_SESSION['user'])) { +function get_post_list() { + if (isset($_SESSION['user'])) { - $posts = get_profile($_SESSION['user'], null, null); + $posts = get_profile($_SESSION['user'], null, null); - if(!empty($posts)) { + if(!empty($posts)) { - echo ''; - foreach($posts as $p) { - echo ''; - echo ''; - echo ''; - echo ''; - } - echo '
' . $p->file . '
'; + echo ''; + foreach($posts as $p) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + echo '
' . $p->file . '
'; + } } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/admin/includes/user.php b/admin/includes/user.php new file mode 100644 index 0000000..12dfb74 --- /dev/null +++ b/admin/includes/user.php @@ -0,0 +1,10 @@ + + + + Admin Panel @@ -18,16 +23,20 @@ - - +

Your blog posts:

+ +

Static page:

+ +

Login Form

-
+ User:


Pass:
diff --git a/admin/users/username.ini.example b/admin/users/username.ini.example new file mode 100644 index 0000000..000ee5e --- /dev/null +++ b/admin/users/username.ini.example @@ -0,0 +1,2 @@ +;Password +password = yourpassword \ No newline at end of file