Advertisement
Guest User

Untitled

a guest
Nov 25th, 2016
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.61 KB | None | 0 0
  1. <?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. ?>
  21. <?php
  22. require_once 'users/init.php';
  23. require_once $abs_us_root.$us_url_root.'users/includes/header.php';
  24. require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
  25. ?>
  26.  
  27. <?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
  28. <?php
  29.  
  30. //End of extra queries
  31.                 if (isset($_POST["submit"])) {
  32.  
  33.                 $name = Input::get('name');
  34.                 $email = $_POST['email'];
  35.                 $message = $_POST['message'];
  36.                 $human = intval($_POST['human']);
  37.                 $from = $user->data()->email;
  38.                 //Your code is right, but I didn't do a thatUser variable, so I stuck an email address in there
  39.                 $to = 'youremailhere@aol.com';
  40.                 //$to = $thatUser->email;
  41.                 $subject = 'Message from Local Positivity Finder';
  42.  
  43.                 $body ="From: $name\n <br>E-Mail: $email\n Message: $message\n";
  44.  
  45.                 // Check if name has been entered
  46.                 if (!$_POST['name']) {
  47.                         $errName = 'Please enter your name';
  48.                 }
  49.  
  50.                 // Check if email has been entered and is valid
  51.                 if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
  52.                         $errEmail = 'Please enter a valid email address';
  53.                 }
  54.  
  55.                 //Check if message has been entered
  56.                 if (!$_POST['message']) {
  57.                         $errMessage = 'Please enter your message';
  58.                 }
  59.                 //Check if simple anti-bot test is correct
  60.                 if ($human !== 5) {
  61.                         $errHuman = 'Your anti-spam is incorrect';
  62.                 }
  63.  
  64.                 // If there are no errors, send the email
  65.                 if (!isset($errName) && !isset($errEmail) && !isset($errMessage) && !isset($errHuman)) {
  66.                 $mail_result=email($to,$subject,$body);
  67.                 if ($mail_result) {
  68.                         bold("<br><br>success!");
  69.                         //Redirect::to($us_url_root.'users/contact_success.php');
  70.                 } else {
  71.                         bold("<br><br>fail!");
  72.                         //Redirect::to($us_url_root.'users/contact_error.php');
  73.                 }
  74.                 }
  75. }
  76.  
  77. ?>
  78. <div id="page-wrapper">
  79.     <div class="container-fluid">
  80.         <!-- Page Heading -->
  81.         <div class="row">
  82.             <div class="col-sm-12">
  83.                 <h1 class="page-header">
  84.                     Welcome to UserSpice
  85.                     <small>An Open Source PHP User Management Framework</small>
  86.                 </h1>
  87.                 <!-- Content goes here -->
  88. <form class="form-horizontal" role="form" method="post" action="profile.php">
  89.  
  90.  
  91.                     <div class="form-group">
  92.                         <label for="name" class="col-sm-2 control-label">Name*</label>
  93.                         <div class="col-sm-10">
  94.                             <input type="text" class="form-control" id="name" name="name" placeholder="First & Last Name" value="<?php if($_POST){echo htmlspecialchars($_POST['name']);} ?>">
  95.                             <?php if($_POST){echo "<p class='text-danger'>$errName</p>";}?>
  96.                         </div>
  97.                     </div>
  98.                     <div class="form-group">
  99.                         <label for="email" class="col-sm-2 control-label">Email*</label>
  100.                         <div class="col-sm-10">
  101.                             <input type="email" class="form-control" id="email" name="email" placeholder="example@domain.com" value="<?php if($_POST){echo htmlspecialchars($_POST['email']);} ?>">
  102.                             <?php if($_POST){echo "<p class='text-danger'>$errEmail</p>";}?>
  103.                         </div>
  104.                     </div>
  105.                     <div class="form-group">
  106.                         <label for="message" class="col-sm-2 control-label">Message*</label>
  107.                         <div class="col-sm-10">
  108.                             <textarea class="form-control" rows="4" name="message"><?php if($_POST){echo htmlspecialchars($_POST['message']);}?></textarea>
  109.                             <?php if($_POST){echo "<p class='text-danger'>$errMessage</p>";}?>
  110.                         </div>
  111.                     </div>
  112.                     <div class="form-group">
  113.                         <label for="human" class="col-sm-2 control-label">2 + 3 = ?*</label>
  114.                         <div class="col-sm-10">
  115.  
  116.                                     <input type="text" class="form-control" id="human" name="human" placeholder="Your Answer">
  117.                             <?php if($_POST){echo "<p class='text-danger'>$errHuman</p>";}?>
  118.                         </div>
  119.                     </div>
  120.                         <div class="form-group">
  121.                         <div class="col-sm-10 col-sm-offset-2">
  122.                             <input id="submit" name="submit" type="submit" value="Send" class="btn btn-custom">
  123.                         </div>
  124.                     </div>
  125.                 </form>
  126.  
  127.                 <!-- Content Ends Here -->
  128.             </div> <!-- /.col -->
  129.         </div> <!-- /.row -->
  130.     </div> <!-- /.container -->
  131. </div> <!-- /.wrapper -->
  132.  
  133.  
  134. <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
  135.  
  136. <!-- Place any per-page javascript here -->
  137.  
  138. <?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