allow removing any student as long as numfound > minstudents, since removing needs to be one at a time this will work out okay.

also, add a note about changing email address needs re-login
auto-logout on email address change
This commit is contained in:
james 2004-12-07 05:33:26 +00:00
parent 0b46ebb808
commit 00b5ee9642
2 changed files with 5 additions and 7 deletions

View File

@ -25,8 +25,7 @@ echo mysql_error();
if(mysql_num_rows($q)==0)
{
echo "error";
// header("Location: register_participants.php");
header("Location: register_participants.php?action=logout");
exit;
}

View File

@ -42,11 +42,9 @@ if($_POST['action']=="save")
$x=1;
while($_POST["num"][$x])
{
//FIXME: move required field checking up here
if($_POST['id'][$x]==0)
{
//INSERT new record
//FIXME: check for required fields before allowing INSERT
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,email,address,city,province,postalcode,phone,dateofbirth,grade,year) VALUES (".
"'".$_SESSION['registration_id']."', ".
@ -69,7 +67,6 @@ echo mysql_error();
else
{
//UPDATE existing record
//FIXME: check for required fields before allowing UPDATE
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
mysql_query("UPDATE students SET ".
"firstname='".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
@ -192,7 +189,7 @@ if($_GET['action']=="removestudent")
echo " <td>".i18n("Grade")."</td><td>\n";
echo "<select name=\"grade[$x]\">\n";
echo "<option value=\"\">".i18n("Choose Grade")."</option>\n";
echo "<option value=\"\">".i18n("Grade")."</option>\n";
for($gr=$config['mingrade'];$gr<=$config['maxgrade'];$gr++)
{
if($studentinfo->grade==$gr) $sel="selected=\"selected\""; else $sel="";
@ -228,7 +225,7 @@ if($_GET['action']=="removestudent")
*/
echo "</table>";
if($x>$config['minstudentsperproject'] && $studentinfo->id)
if($numfound>$config['minstudentsperproject'] && $studentinfo->id)
{
echo "<div align=\"right\"><a onclick=\"return confirmClick('".i18n("Are you sure you want to remove this student from the project?")."');\" class=\"caution\" href=\"register_participants_students.php?action=removestudent&amp;removestudent=$studentinfo->id\">".i18n("Remove this student from project")."</a></div>";
}
@ -238,6 +235,8 @@ if($_GET['action']=="removestudent")
}
echo "<input type=submit value=\"".i18n("Save Student Information")."\">\n";
echo "</form>";
echo "<br />";
echo notice(i18n("Note: if you change the email address that you are logged in with right now, you will be automatically logged out and will need to log back in again with your new email address"));
send_footer();
?>