Exemple #1
0
function display_add_users_conf_form($new_users)
{
    //$users is an array with seperate different users' names at each index- with addslashes (by magic_quotes)
    ?>
<table width="90%">
<tr>
	<td align="center" class="naglowek">Zaraz dodasz u¿ytkowników<hr></td>
</tr>
<tr>
	<td>
	<table>
<?php 
    if (!empty($new_users)) {
        ?>
	<tr>
		<td align="right" valign="top"><b>Istniej±cy u¿ytkownicy (zostan± zignorowani):</b></td>
		<td align="left">
<?php 
        $existing_users = get_existing_users($new_users);
        if ($existing_users === false) {
            echo 'B³±d bazy danych, spróbuj pó¼niej.';
        } else {
            if (empty($existing_users)) {
                echo '-';
            } else {
                foreach (array_keys($existing_users) as $user_id) {
                    display_link_to_user($user_id);
                    echo "<br>\n";
                }
            }
        }
        ?>
		</td>
	</tr>
	<tr>
		<td align="right" valign="top"><b>Nowi u¿ytkownicy:</b></td>
		<td align="left">
<?php 
        $new_users = get_new_users($new_users);
        if (empty($new_users)) {
            echo '-';
        } else {
            foreach ($new_users as $user) {
                echo $user . "<br>\n";
            }
        }
        ?>
        </td>
	</tr>
<?php 
    }
    ?>
	<tr>
		<td align="right"><form action="add_users_form.php" method="post">
		<input type="hidden" name="users" value="<?php 
    echo htmlspecialchars(join("\n", $new_users));
    ?>
">
		<input type="submit" value="Wstecz"></form>
		</td>
		<td align="left">
		<form action="add_users.php" method="post">
		<input type="hidden" name="confirmed" value="yes">
		<input type="hidden" name="users" value="<?php 
    echo htmlspecialchars(join("\n", $new_users));
    ?>
">
		<input type="submit" value="Zatwierd¼">
		</form>
		</td>
	</tr>
	</table>
	</td>
</tr>
</table>
<?php 
}
Exemple #2
0
function get_new_users($users)
{
    $existing_users = get_existing_users($users);
    return array_diff($users, $existing_users);
}