Source for file reg-policies.php

Documentation is available at reg-policies.php

  1. <?php
  2. /**
  3. * Updated catch-all registration email for a team.
  4. *
  5. * This file is part of CompInaBox.
  6. * @copyright Copyright 2001-2005. Eric D. Nielsen, All rights reserverd.
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. * @author Eric D. Nielsen <nielsene@alum.mit.edu>
  9. *
  10. * @package WebPages
  11. * @subpackage Team-Admin
  12. * @internal This file is called from within the admin script up on-level
  13. * in the directory, the admin script handles all the setup tasks needed.
  14. */
  15. // {{{ Variable Importation
  16. $valid=TRUE;
  17. if (isset($_POST["reg_email"]) && $_POST["reg_email"]!="")
  18. {
  19. $regEmail = htmlspecialchars(trim($_POST["reg_email"]));
  20. if (strpos($regEmail,'@'))
  21. $_SESSION["formVars"]["RegEmail_msg"]="";
  22. else
  23. {
  24. $valid=FALSE;
  25. $_SESSION["formVars"]["RegEmail_msg"]="Please enter a valid email address.";
  26. }
  27. }
  28. else
  29. {
  30. $regEmail="";
  31. }
  32. $_SESSION["formVars"]["RegEmail"]=$regEmail;
  33. // }}}
  34.  
  35. if (!$valid)
  36. {
  37. localRedirect("Location: {$CIB_BASE_URL}team/admin/$teamID/Overview");
  38. exit();
  39. }
  40.  
  41. $query="SELECT email FROM team_registration_emails WHERE teamid=$teamID;";
  42. $result=$db->query($query);
  43. if ($result->numrows())
  44. list($curEmail)=$result->getRowAt(0);
  45. else
  46. $curEmail="";
  47.  
  48. // Get Possible Sets of Matches
  49.  
  50. $db->startTransaction();
  51. if ($regEmail=="")
  52. {
  53. if ($curEmail!="")
  54. {
  55. $query="DELETE FROM team_registration_emails WHERE teamid=$teamID;";
  56. $_SESSION["formVars"]["RegEmail_msg"]="Registration email removed.";
  57. }
  58. }
  59. else
  60. {
  61. if ($curEmail=="")
  62. {
  63. $query="INSERT INTO team_registration_emails (teamid,email) VALUES ($teamID,'$regEmail');";
  64. $_SESSION["formVars"]["RegEmail_msg"]="Registration email added.";
  65. }
  66. else if ($curEmail!=$regEmail)
  67. {
  68. $query="UPDATE team_registration_emails SET email='$regEmail';";
  69. $_SESSION["formVars"]["RegEmail_msg"]="Registration email changed.";
  70. }
  71. }
  72. $db->query($query);
  73. $db->commit();
  74. localRedirect("Location: {$CIB_BASE_URL}team/admin/$teamID/Overview");
  75. exit();
  76. ?>

Documentation generated on Tue, 25 Apr 2006 13:08:48 -0400 by phpDocumentor 1.3.0RC3