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"
Admin control Message Board!
Moderator: General Moderators
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
Re: Admin control Message Board!
Any one please help me, my problem was how to delete a topic thanks.
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
Re: Admin control Message Board!
could any one help me here? 
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
Re: Admin control Message Board!
help me here? 
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
Re: Admin control Message Board!
Can anyone here can gave me a simple answer? 3 days passed but i cannot fix my board. 
- blackscorpion
- Forum Newbie
- Posts: 22
- Joined: Wed May 28, 2008 9:18 pm
Re: Admin control Message Board!
anyone please?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Admin control Message Board!
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
Deletion page
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.
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>';
}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>';