Page 1 of 1
Admin control Message Board!
Posted: Sun Jun 01, 2008 5:56 am
by blackscorpion
First of all i want to thank all for helping me fix may simple message board, but know I would like to have a admin control that i can delete a message or topic post in may message board with password so the admin has thy only one can erase a topic for spam control or unrelated topic.
If you have a tutorial about the code i would glad to read and study the code even thou im not good in php code!
(im not a computer related student im just a Nursing Student hehe! but i dont really want nursing may parents want it, computer science was my first choice T_T)
This is may message board
http://www.prowebz.890m.com/main_forum.php
--------------------------
"google first before asking"
Re: Admin control Message Board!
Posted: Sun Jun 01, 2008 11:23 pm
by blackscorpion
Any one please help me, my problem was how to delete a topic thanks.
Re: Admin control Message Board!
Posted: Tue Jun 03, 2008 6:29 am
by blackscorpion
could any one help me here?

Re: Admin control Message Board!
Posted: Tue Jun 03, 2008 7:52 am
by blackscorpion
help me here?

Re: Admin control Message Board!
Posted: Wed Jun 04, 2008 3:04 am
by blackscorpion
Can anyone here can gave me a simple answer? 3 days passed but i cannot fix my board.

Re: Admin control Message Board!
Posted: Tue Jun 10, 2008 7:25 am
by blackscorpion
anyone please?
Re: Admin control Message Board!
Posted: Tue Jun 10, 2008 11:03 am
by superdezign
Well, 5 spam posts in a row aside, I think the reason you haven't gotten an answer is because your question was asking for a tutorial on how to create an administration system. I don't know of one, and I've never made a tutorial for the way I create CRUD (Create-Remove-Update-Duplicate) systems, I just create them. I've made about 4 or 5 different designs of them, each time becoming a bit more flexible and expandable. But, my latest isn't easy or fast to teach, so I'll help you with a basic one for deleting your topics.
Administration page
Code: Select all
// http://your.website.tld/forums/admin/index.php
$result = mysql_query("SELECT * FROM `topics` ORDER BY `date_posted` DESC");
while ($data = mysql_fetch_object($result)) {
echo '<a href="http://your.website.tld/forums/admin/delete.php?id='
. $data->topic_id
. '">Delete "'
. $data->topic_title
. '"</a>';
}
Deletion page
Code: Select all
// http://your.website.tld/forums/admin/delete.php
if (!empty($_POST) && isset($_POST['id'], $_GET['id'])) {
if ($_GET['id'] == $_POST['id']) {
mysql_query("DELETE FROM `topics` WHERE `topic_id` = " . (int)$_POST['id']);
echo 'Post #' . $_POST['id'] . ' was successfully deleted.';
exit;
}
}
echo '<form action="#" method="post">'
. '<p>Are you sure that you want to delete this post?</p>'
. '<input type="hidden" value="'
. (int)$_GET['id']
. '" />'
. '<button type="submit">Delete</button>'
. '</form>';
It's up to you to make this secure and unavailable to non-administrative users. I've added a little bit of security into it for you, but it is all basic. There may be typos, as this code has not been tested and I haven't worked outside of my database wrapper class for a very long time, but as long as you understand PHP and / or are a fast-learner, this should be enough to get you started. Enjoy.