ich habe das Point System installiert und dort gebe ich 15 Punkte pro Antwort und 35 Punkte pro Thema her. Da es auch einen Off-Topic Bereich bei uns gibt, in dem die Punkte nicht gezählt werden.
Jetzt ist ja mit in dem Mod noch diese Datei dabei:
Code: Alles auswählen
define('IN_PHPBB', true);
$phpbb_root_path='./';
include($phpbb_root_path.'extension.inc');
include($phpbb_root_path.'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if (!$userdata['session_logged_in'])
{
header('Location: ' . append_sid("login.$phpEx?redirect=update_user_points.$phpEx", true));
}
if ($userdata['user_level'] != ADMIN)
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}
$sql = "SELECT user_id
FROM " . USERS_TABLE . "
WHERE user_id != " . ANONYMOUS;
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not!', '', __LINE__, __FILE__, $sql);
}
$users = $db->sql_fetchrowset($result);
$total_users = count($users);
for($i = 0; $i < $total_users; $i++)
{
$user_id = $users[$i]['user_id'];
$sql = "SELECT COUNT(*) as all_posts
FROM " . POSTS_TABLE . "
WHERE poster_id = $user_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not!', '', __LINE__, __FILE__, $sql);
}
$all_posts = $db->sql_fetchrow($result);
$sql = "SELECT COUNT(*) as total_topics
FROM " . TOPICS_TABLE . "
WHERE topic_poster = $user_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not!', '', __LINE__, __FILE__, $sql);
}
$total_topics = $db->sql_fetchrow($result);
$total_posts = $all_posts['all_posts'] - $total_topics['total_topics'];
$total_topics = $total_topics['total_topics'];
$points = 0;
$points = $points + ($total_posts * $board_config['points_reply']);
$points = $points + ($total_topics * $board_config['points_topic']);
$sql = "UPDATE " . USERS_TABLE . "
SET user_points = $points
WHERE user_id = $user_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not!', '', __LINE__, __FILE__, $sql);
}
}
message_die(GENERAL_MESSAGE, 'Punkte erfolgreich geupdatet.');
?>
Wenn es an der Gesantbeitragszahl des USers liegt, wie bekomme ich die Beitragszahl auf die korrekte Zahl gestellt (ohne dem Off-Topic).
Danke für jegliche Hilfe