Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
validate_email.php
Go to the documentation of this file.
1 <?php
2 
3  /**
4  * @file validate_email.php
5  *
6  * @brief This script handles the validation of the email-address.
7  *
8  * @details
9  * This file handles the validation of the email-address. Its main task is
10  * to evaluate the token passed as part of the url. If the token is accepted
11  * the users email has been verified.
12  * This file depends on inc/common.php and templates/nocontent.tpl.
13  * This file is based on activate-account.php from UserCake Version: 2.0.2*
14  *
15  * @copyright (c) 2013, Team StarCraft e.V.
16  * @version 1.0.0
17  * @author Usercake (http://usercake.com)
18  * @author Alexander Vorndran
19  * @date 02.07.2013
20  */
21 
22 
23  /// @cond MAINPART
24  // include
25  include("inc/common.php");
26 
27 
28  // UserCake
29  if(!accessGranted($_SERVER['PHP_SELF'])) {
30  if (isUserLoggedIn()) {
31  exitWithErrorTemplate(array('Die angeforderte Seite ist gesperrt.'));
32  }
33  else {
34  exitWithErrorTemplateAndRedirect(array('Die angeforderte Seite ist gesperrt oder geschützt.'), 'login.php', 2);
35  }
36  }
37 
38  if(isset($_GET["token"])) {
39  // Get token param
40  $token = $_GET["token"];
41  if (!isset($token)) {
42  $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
43  } else if (!validateActivationToken($token)) {
44  //Check for a valid token. Must exist and valid_email must be 0
45  $errors[] = lang("ACCOUNT_TOKEN_NOT_FOUND");
46  }
47  else {
48  //Activate the users account
49  if (!setMailValid($token)) {
50  $errors[] = lang("SQL_ERROR");
51  }
52  }
53  }
54  else { //!
55  $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
56  };
57 
58  if (count($errors) == 0) {
59  $successes[] = "Die E-Mail-Adresse wurde erfolgreich validiert.";
60  }
61 
62  displayTemplateWithErrorsAndSuccesses('E-Mail validiert', 'nocontent.tpl');
63  /// @endcond
64 ?>