-
Notifications
You must be signed in to change notification settings - Fork 0
/
nosuccess.php
69 lines (62 loc) · 2.22 KB
/
nosuccess.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php include_once("includes/sessions.php"); ?>
<?php require_once("includes/config.php"); ?>
<?php include_once("includes/dbconnection.php"); ?>
<?php
$error = '';
if (isset($_POST['submit'])) {
// Email address validation
$emailPattern = "/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i";
if (!preg_match($emailPattern, $_POST['email'])) {
$error = "A Valid Email Address is Required";
}
}
?>
<?php
if (empty($error) && isset($_POST['submit'])) {
$email = $_POST['email'];
//Email String-----------------------------------------
$msg = "First Name: ".$_POST["fname"]."\n";
$msg .= "Last Name: ".$_POST["lname"]."\n";
$msg .= "E-mail: ".$_POST["email"]."\n";
$msg .= "Phone: ".$_POST["phone"]."\n";
$msg .= "Address: ".$_POST["address"]."\n";
$msg .= "Apartment #: ".$_POST["apt"]."\n";
$msg .= "City: ".$_POST["city"]."\n";
$msg .= "State: ".$_POST["state"]."\n";
$msg .= "Zip: ".$_POST["zip"]."\n";
$msg .= "Type: ".$_POST["type"]."\n";
$msg .= "Comment: ".$_POST["comment"]."\n";
//PULL EMAIL FROM DB------------------------------------
$sql = "SELECT * FROM contact_email";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
//Mail Header Information
$recipient = "$row[email]";
$subject = "AURA SHOP WEBSITE SUBMISSION";
$mailheaders = "From: ".$_POST["email"]."\n";
$mailheaders .= "Reply-To: ".$_POST["email"]."\n";
//Send Mail
mail($recipient, $subject, $msg, $mailheaders);
if (mail) {
header("Location: success.php");
exit;
} else {
header("Location: nosuccess.php");
exit;
}
}
?>
<?php
//PRINTS TITLE OF PAGE FROM VARIABLE
$title = "Aurashop Crystals, Healing, Aura, Chakra, and the Metaphysical";
$nav = "home";
?>
<?php require_once("includes/top.php"); ?>
<div id="content_wrapper">
<?php require_once("includes/navbar.php"); ?>
<div id="Load">
<h2>Contact Us</h2>
<p>Your e-mail was NOT submitted. Please try again at a later time. If the problem persists contact the <a href="mailto: [email protected]">webmaster</a>.</p>
</div><!--ENDS CONTENT_MAIN DIV-->
</div><!--ENDS CONTENT_WRAPPER DIV-->
<?php require_once("includes/site_info.php"); ?>