Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
export_list.php
Go to the documentation of this file.
1 <?php
2  /**
3  * @file export_list.php
4  *
5  * @brief Displays a list with email addresses of contact persons.
6  *
7  * @details
8  * Has the possiblities to load all email addresses from the database or just
9  * the ones the user has chosen to export.
10  *
11  * @copyright (c) 2013, Team StarCraft e.V.
12  * @version 1.0.0
13  * @author Niklas Engelhardt
14  * @author Alexander Vorndran
15  * @date 02.07.2013
16  */
17 
18  /// @cond MAINPART
19  // include
20  include("inc/common.php");
21 
22  // UserCake
23  if(!accessGranted($_SERVER['PHP_SELF'])) {
24  if (isUserLoggedIn()) {
25  exitWithErrorTemplate(array('Die angeforderte Seite ist gesperrt.'));
26  }
27  else {
28  exitWithErrorTemplateAndRedirect(array('Die angeforderte Seite ist gesperrt oder geschützt.'), 'login.php', 2);
29  }
30  }
31 
32  if(isset($_GET['result'])) {
33  // this result identifier is the key to obtain the data the user has selected for export
34  $resultIdentifier = $_GET['result'];
35  if(ctype_alnum($resultIdentifier)) {
36  $sponsorIds = $loggedInUser->loadResult($_GET['result']);
37  $mailaddresses = fetchMailAdresses($sponsorIds);
38  } else {
39  $err[] = "Token ungültig!";
41  }
42  } else {
43  // the user wants to export all mail-addresses
44  $mailaddresses=(fetchMailAdresses());
45  }
46 
47  echo writeCsvFile($mailaddresses,false);
48  die();
49 
50  /// @endcond
51 ?>
52 
53 
54