Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. W<?php
  2. /*
  3. UserSpice 4
  4. An Open Source PHP User Management System
  5. by the UserSpice Team at http://UserSpice.com
  6.  
  7. This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */ ?>
  20. <?php require_once 'init.php'; ?>
  21. <?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
  22. <?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
  23.  
  24. <?php
  25. if($user->isLoggedIn()){
  26. $user->logout();
  27. Redirect::to('verify_resend.php');
  28. }
  29.  
  30. $token = Input::get('csrf');
  31. if(Input::exists()){
  32. if(!Token::check($token)){
  33. die('Token doesn\'t match!');
  34. }
  35. }
  36.  
  37. $email_sent=FALSE;
  38.  
  39. $errors = array();
  40. if(Input::exists('post')){
  41. $email = Input::get('email');
  42. $fuser = new User($email);
  43.  
  44. $validate = new Validate();
  45. $validation = $validate->check($_POST,array(
  46. 'email' => array(
  47. 'display' => 'Email',
  48. 'valid_email' => true,
  49. 'required' => true,
  50. ),
  51. ));
  52. if($validation->passed()){ //if email is valid, do this
  53.  
  54. if($fuser->exists()){
  55. //send the email
  56. $options = array(
  57. 'fname' => $fuser->data()->fname,
  58. 'email' => rawurlencode($email),
  59. 'vericode' => $fuser->data()->vericode,
  60. );
  61. $encoded_email=rawurlencode($email);
  62. $subject = 'Verify Your Email';
  63. $body = email_body('_email_template_verify.php',$options);
  64. $email_sent=email($email,$subject,$body);
  65. if(!$email_sent){
  66. $errors[] = 'Email NOT sent due to error. Please contact site administrator.';
  67. }
  68. }else{
  69. $errors[] = 'That email does not exist in our database';
  70. }
  71. }else{
  72. $errors = $validation->errors();
  73. }
  74. }
  75.  
  76. ?>
  77.  
  78. <div id="page-wrapper">
  79. <div class="container">
  80.  
  81. <?php
  82.  
  83. if ($email_sent){
  84. require 'views/_verify_resend_success.php';
  85. }else{
  86. require 'views/_verify_resend.php';
  87. }
  88.  
  89. ?>
  90. </div>
  91. </div>
  92.  
  93. <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
  94.  
  95. <!-- Place any per-page javascript here -->
  96.  
  97. <?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement