[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/ -> verify.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // redirect verify to correct newsletter action
  24  
  25  $phpwcms = array();
  26  require_once ('config/phpwcms/conf.inc.php');
  27  require_once  ('include/inc_lib/default.inc.php');
  28  
  29  $type    = '';
  30  $email    = 'n.a.';
  31  
  32  if(!empty($_GET['s']) || !empty($_GET['u'])) {
  33  
  34      require_once  (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  35      require_once  (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
  36      require_once  (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php');
  37      
  38      if(isset($_GET['s'])) {
  39      
  40          $hash = clean_slweg($_GET['s']);
  41          $type = 'subscribe';
  42      
  43      } else {
  44      
  45          $hash = clean_slweg($_GET['u']);
  46          $type = 'unsubscribe';
  47          
  48      }
  49  
  50      $data = _dbQuery('SELECT * FROM '.DB_PREPEND."phpwcms_address WHERE address_key='".aporeplace($hash)."' LIMIT 1");
  51  
  52      if(isset($data[0])) {
  53      
  54          $email = $data[0]['address_email'];
  55          switch($type) {
  56          
  57              case 'subscribe':        $sql  = 'UPDATE '.DB_PREPEND.'phpwcms_address ';
  58                                      $sql .= 'SET address_verified=1 ';
  59                                      $sql .= "WHERE address_key='".aporeplace($hash)."'";
  60                                      if(empty($data[0]['address_verified'])) {
  61                                          $result = _dbQuery($sql, 'UPDATE');
  62                                      }
  63                                      if(!empty($data[0]['address_url1'])) {
  64                                          headerRedirect($data[0]['address_url1']);
  65                                      }
  66                                      
  67                                      if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/subscribe.tmpl'))) {
  68                          
  69                                          $page = "The email address <strong>{EMAIL}</strong> was verified.";
  70                          
  71                                      }
  72                                      break;
  73                                      
  74              
  75              case 'unsubscribe':        $sql  = 'DELETE FROM '.DB_PREPEND.'phpwcms_address ';
  76                                      $sql .= "WHERE address_key='".aporeplace($hash)."'";
  77                                      $result = _dbQuery($sql, 'DELETE');
  78                                      if(!empty($data[0]['address_url2'])) {
  79                                          headerRedirect($data[0]['address_url2']);
  80                                      }
  81                                      
  82                                      if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/unsubscribe.tmpl'))) {
  83                              
  84                                          $page = "All Subscriptions for <strong>{EMAIL}</strong> canceled.";
  85                          
  86                                      }
  87                                      
  88                                      break;
  89                                  
  90          }
  91          
  92      
  93      } else {
  94      
  95          headerRedirect(PHPWCMS_URL);
  96      
  97      }
  98      
  99  } else {
 100  
 101      headerRedirect(PHPWCMS_URL);
 102  
 103  }
 104  
 105  // some replacements
 106  $page = replaceGlobalRT($page);
 107  $page = str_replace('{EMAIL}', $email, $page);
 108  
 109  // send non caching page header
 110  headerAvoidPageCaching();
 111  echo $page;
 112  
 113  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7