Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- UserSpice 4
- An Open Source PHP User Management System
- by the UserSpice Team at http://UserSpice.com
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- ?>
- <?php
- require_once 'users/init.php';
- require_once $abs_us_root.$us_url_root.'users/includes/header.php';
- require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
- ?>
- <?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
- <?php
- //End of extra queries
- if (isset($_POST["submit"])) {
- $name = Input::get('name');
- $email = $_POST['email'];
- $message = $_POST['message'];
- $human = intval($_POST['human']);
- $from = $user->data()->email;
- //Your code is right, but I didn't do a thatUser variable, so I stuck an email address in there
- $to = 'youremailhere@aol.com';
- //$to = $thatUser->email;
- $subject = 'Message from Local Positivity Finder';
- $body ="From: $name\n <br>E-Mail: $email\n Message: $message\n";
- // Check if name has been entered
- if (!$_POST['name']) {
- $errName = 'Please enter your name';
- }
- // Check if email has been entered and is valid
- if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
- $errEmail = 'Please enter a valid email address';
- }
- //Check if message has been entered
- if (!$_POST['message']) {
- $errMessage = 'Please enter your message';
- }
- //Check if simple anti-bot test is correct
- if ($human !== 5) {
- $errHuman = 'Your anti-spam is incorrect';
- }
- // If there are no errors, send the email
- if (!isset($errName) && !isset($errEmail) && !isset($errMessage) && !isset($errHuman)) {
- $mail_result=email($to,$subject,$body);
- if ($mail_result) {
- bold("<br><br>success!");
- //Redirect::to($us_url_root.'users/contact_success.php');
- } else {
- bold("<br><br>fail!");
- //Redirect::to($us_url_root.'users/contact_error.php');
- }
- }
- }
- ?>
- <div id="page-wrapper">
- <div class="container-fluid">
- <!-- Page Heading -->
- <div class="row">
- <div class="col-sm-12">
- <h1 class="page-header">
- Welcome to UserSpice
- <small>An Open Source PHP User Management Framework</small>
- </h1>
- <!-- Content goes here -->
- <form class="form-horizontal" role="form" method="post" action="profile.php">
- <div class="form-group">
- <label for="name" class="col-sm-2 control-label">Name*</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" id="name" name="name" placeholder="First & Last Name" value="<?php if($_POST){echo htmlspecialchars($_POST['name']);} ?>">
- <?php if($_POST){echo "<p class='text-danger'>$errName</p>";}?>
- </div>
- </div>
- <div class="form-group">
- <label for="email" class="col-sm-2 control-label">Email*</label>
- <div class="col-sm-10">
- <input type="email" class="form-control" id="email" name="email" placeholder="example@domain.com" value="<?php if($_POST){echo htmlspecialchars($_POST['email']);} ?>">
- <?php if($_POST){echo "<p class='text-danger'>$errEmail</p>";}?>
- </div>
- </div>
- <div class="form-group">
- <label for="message" class="col-sm-2 control-label">Message*</label>
- <div class="col-sm-10">
- <textarea class="form-control" rows="4" name="message"><?php if($_POST){echo htmlspecialchars($_POST['message']);}?></textarea>
- <?php if($_POST){echo "<p class='text-danger'>$errMessage</p>";}?>
- </div>
- </div>
- <div class="form-group">
- <label for="human" class="col-sm-2 control-label">2 + 3 = ?*</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" id="human" name="human" placeholder="Your Answer">
- <?php if($_POST){echo "<p class='text-danger'>$errHuman</p>";}?>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-10 col-sm-offset-2">
- <input id="submit" name="submit" type="submit" value="Send" class="btn btn-custom">
- </div>
- </div>
- </form>
- <!-- Content Ends Here -->
- </div> <!-- /.col -->
- </div> <!-- /.row -->
- </div> <!-- /.container -->
- </div> <!-- /.wrapper -->
- <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
- <!-- Place any per-page javascript here -->
- <?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