function settings() { global $base_script, $take_backup, $make_user_owner, $protect_root_file, $keep_phpini_on_enable, $keep_phpini_on_disable, $always_show_all; $on_off[0] = "Off"; $on_off[1] = "On"; print "<table align='center' width='80%' border='0' cellspacing='0' cellpadding='4' bgcolor='#FFFFFF' style='border:1px solid #990000'>"; print '<FORM ACTION="' . $base_script . '" METHOD=POST>'; print '<INPUT TYPE="HIDDEN" NAME="action" VALUE="save_settings">'; print "<tr><td width=20%><strong>Setting</strong></td><td width=10%><strong>Value</strong></td><td width=70%><strong>Information</strong></td></tr>"; print "<tr class=\"row_dark\"><td>Always show all</td><td>" . array_to_select($on_off, $always_show_all, 'always_show_all') . "</td><td>Always show all domains, subdomains, ... in the account list</td></tr>"; print "<tr class=\"row_light\"><td> </td><td> </td><td> </td></tr>"; print "<tr class=\"row_dark\"><td>Take backup</td><td>" . array_to_select($on_off, $take_backup, 'take_backup') . "</td><td>Makes a backup copy when editing and updating php.ini files. Will be saved at same location as php.ini.<unix_timestamp></td></tr>"; print "<tr class=\"row_light\"><td>Make user owner</td><td>" . array_to_select($on_off, $make_user_owner, 'make_user_owner') . "</td><td>Makes the user own the custom php.ini file</td></tr>"; print "<tr class=\"row_dark\"><td>Protect php.ini</td><td>" . array_to_select($on_off, $protect_root_file, 'protect_root_file') . "</td><td>Prevents the user from deleting the php.ini file (uses chattr)</td></tr>"; print "<tr class=\"row_light\"><td>Keep php.ini on enable</td><td>" . array_to_select($on_off, $keep_phpini_on_enable, 'keep_phpini_on_enable') . "</td><td>Keep existing php.ini files when enabled</td></tr>"; print "<tr class=\"row_dark\"><td>Keep php.ini on disable</td><td>" . array_to_select($on_off, $keep_phpini_on_disable, 'keep_phpini_on_disable') . "</td><td>Keep existing php.ini files when disabled</td></tr>"; print "<tr class=\"row_light\"><td colspan=3><INPUT TYPE=SUBMIT VALUE=\"Save\"></td></tr>"; print "</FORM>"; print "</table>"; }
<?php require_once '../TME2/entete.php'; function array_to_select($nom, $groupes) { $r = ''; if (is_array($groupes)) { foreach ($groupes as $k => $v) { $r .= "<option value='{$k}'>Groupe {$k}, nombre d'inscrits: " . count($v) . "</option>\n"; } $r = "<form action='gestionNotesEtudiants.php' method='post'><fieldset>" . "<label for='num_groupe'>Choisissez un groupe</label>\n" . "<select id='num_groupe' name='num_groupe'>{$r}</select>" . "<input type='hidden' name='nom' value='{$nom}' />" . "<input type='submit' />" . "</fieldset></form>\n"; } if (!$r) { $titre = "Erreur :"; $r = "Pas de groupe"; } else { $titre = ''; } return entete($titre . "Choix du groupe pour {$nom}") . "<body>{$r}</body></html>\n"; } // test include $f = '/var/tmp/' . $_POST['nom'] . '.php'; echo array_to_select($_POST['nom'], $groupes);