Code: Alles auswählen
<?php
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
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if(isset($_POST['submit']))
{
$group_id = $_POST['group_id'];
if(empty($group_id))
{
message_die(GENERAL_MESSAGE, "Es muss die Gruppen-ID der Gruppe eingegeben werden, in die alle User eingetragen werden soll");
}
$sql = "SELECT * FROM ". GROUPS_TABLE ."
WHERE group_id = '$group_id'";
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain group data', '', __LINE__, __FILE__, $sql);
}
if((!$row = $db->sql_fetchrow($result)))
{
message_die(GENERAL_MESSAGE, "Diese Gruppe existiert nicht");
}
$sql = "SELECT * FROM ". USERS_TABLE ."
WHERE user_id != -1
AND user_id != '". $row['group_moderator'] ."'";
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not get users data', '', __LINE__, __FILE__, $sql);
}
$users = array();
while($row = $db->sql_fetchrow($result))
{
$users[] = $row;
}
for($i = 0; $i < count($users); $i++)
{
$sql = "INSERT INTO ". USER_GROUP_TABLE ." (group_id, user_id, user_pending)
VALUES ('$group_id', '". $users[$i]['user_id'] ."', '0')";
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not update groups table', '', __LINE__, __FILE__, $sql);
}
}
message_die(GENERAL_MESSAGE, "Alle User eingetragen");
}
else
{
?>
<form method="post">
<table class="forumline" width="40%" align="center" border="0">
<tr>
<th align="center">User eintragen</th>
</tr>
<tr>
<td class="row1" align="center"><input type="text" size="4" name="group_id" /> Gruppen-ID eingeben <input type="submit" class="mainoption" name="submit" value="Eintragen" /></td>
</tr>
</table>
</form>
<?php
}
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Nimm mal das Script und speicher es dir ab. Aufrufen, Gruppen-ID eintragen, fertig.