setting ADMIN commands in functions_post.php
4 posts
• Page 1 of 1
setting ADMIN commands in functions_post.php
so i have added this code to my includes/Functions_post.php file to unlock a topic by just typing "-UNLOCK-" ( with out quotes ).
- Code: Select all
if($userdata['user_level'] == ADMIN)
{
if(strstr($post_message, "-UNLOCK-"))
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_UNLOCKED . "
WHERE topic_id = $topic_id
AND forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
};
};
and i hiave added this code to lock the topic by typing "-LOCK-" ( again, with out the quotes ).
- Code: Select all
if($userdata['user_level'] == ADMIN)
{
if(strstr($post_message, "-LOCK-"))
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . "
WHERE topic_id = $topic_id
AND forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
};
};
now the SET topic_status = " . TOPIC_LOCKED . " or SET topic_status = " . TOPIC_UNLOCKED . " sets the topic locked or unlocked respectivly, what i am having trouble figuring out is how to DELETE the topic via the same method.
is there any one who may know how to do this?
Are you talking about just deleting if the topic is locked or unlocked?
- Code: Select all
$sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id
AND forum_id = $forum_id
AND topic_status = ". TOPIC_UNLOCKED .";"
Or if you only want to delete topics that are locked or unlocked do
- Code: Select all
$sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_status = ". TOPIC_UNLOCKED .";"
HTH,
Jason
- jbullard
- VP - Software
- Posts: 3653
- Joined: Sun Jun 06, 2004 10:17 pm
- Location: Utah
- Real Name: Jason Bullard
4 posts
• Page 1 of 1
Return to HTML, CSS, and Scripts
Who is online
Users browsing this forum: No registered users and 6 guests