-
Notifications
You must be signed in to change notification settings - Fork 2
/
emailShare.php
175 lines (131 loc) · 7.23 KB
/
emailShare.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/thebellringer/includes/variables.php';
require_once $_SERVER['DOCUMENT_ROOT'].'/thebellringer/services/mailProcessor.php';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Send an email</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/emailform.css">
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.html5-placeholder-shim.js"></script>
<?php
// Google Analytics
if ($portable['live']){
include_once $_SERVER['DOCUMENT_ROOT'].'/thebellringer/includes/analytics.php';
}
?>
</head>
<body>
<div class="plaque-email">
<div class="plaque-email-inner">
<?php
$show_form=true;
if(isset($_POST['name']))
{// The form is submitted
$name = $_POST['name'];
$fname = $_POST['fname'];
$visitor_email = $_POST['email'];
$defaultMessage = $_POST['messageCheck'];
$cmessage = $_POST['message'];
$message = 'Help '.$name .', Royale, and the Red Cross raise $10,000 for our friends on the East Coast... '.$_POST['message'];
$email_to = $_POST['femail'];
$email_subject = "Royale Presents: The Bell Ringer";
$email_body = '<div style="white-space:pre-wrap;">'.
'<center><a href="'. $portable['bellSite'].'"><img src="'. $portable['imagePath'] .'email/eshare-bellringer.png" /></a></center>'.
'<center><p style="text-align:left;display:inline-block;width:530px;" >'.
'Greetings '.$fname.', <br /><br />'.
$message.
'</p></center>'.
'<center><a href="'.$portable['royaleSite'].'"><img src="'.$portable['imagePath']. 'email/eshare-logo.png" /></a> </center> '.
'<center><a href="'.$portable['royaleSite'].'"><img src="'. $portable['imagePath'] .'email/eshare-footer.png" /></a> </center>'.
'</div>';
$to = $email_to;
$html = true;
$show_form=false;
$mailSend = sendMessagez($name, $visitor_email, $fname, $email_to, $email_subject, $email_body, $html);
echo ('<div align="center" style="margin:auto;font-size: 35px;margin-top:240px;"><b>'.$mailSend.'</b></div>');
// echo (PATH);
// SQL Stuff
$username = $portable['dbUsername'];
$password = $portable['dbPassword'];
$eamilsDb = $portable['dbDonationsDb'];
$emailShare = $portable['dbShareTable'];
if($defaultMessage == $cmessage){ $dmessage = 'Default';} else{ $dmessage = $cmessage;}
// SQL statements
$sql = 'INSERT INTO '.$emailShare.' (sendname,sendemail,recname,recemail,message) VALUES (:sendname,:sendemail,:recname,:recemail,:message)';
try {
// Establish connection
$conn = new PDO('mysql:host=localhost;dbname='.$eamilsDb.';charset=UTF8', $username, $password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Insert new donation
$stmt = $conn->prepare($sql);
$stmt->bindParam(':sendname', $name);
$stmt->bindParam(':sendemail', $visitor_email);
$stmt->bindParam(':recname', $fname);
$stmt->bindParam(':recemail', $email_to);
// $stmt->bindParam(':subscribe', $subscribe);
$stmt->bindParam(':message', $dmessage);
// $stmt->bindParam(':total', $sum);
$stmt->execute();
} catch(PDOException $e) {
return 'ERROR: ' . $e->getMessage();
}
}//if(isset($_POST['Submit']))
if(true == $show_form)
{
?>
<div class="email-logo-container">
<img class="email-logo" src="images/royale-redcross.png">
</div>
<div class="t-font t-bold t-larger yellow email-title">
Do you know someone who may be itching to be entertained for a few minutes?
</div>
<div class="email-intro t-medium">
Send them an email to spread the word. If Royale raises 10k for The American Red Cross, they'll animate a continuation of Edith's story.
</div>
<form method="post" id="mailPost" name="myemailform" action="">
<div class="t-font t-bold t-larger yellow email-title email-fieldtitle">
From:
</div>
<div class="form-row">
<input type="text" class="email-text" name="name" placeholder="Your name" required>
</div>
<div class="form-row">
<input type="text" class="email-text" name="email" placeholder="Your email address" required>
</div>
<div class="t-font t-bold t-larger yellow email-title email-fieldtitle">
To:
</div>
<div class="form-row">
<input type="text" class="email-text" name="fname" placeholder="Recipient's name" required>
</div>
<div class="form-row">
<input type="text" class="email-text" name="femail" placeholder="Recipient's address" required>
</div>
<div class="t-font t-bold t-larger yellow email-title email-fieldtitle">
Message:
</div>
<div class="form-row">
<textarea class="email-textarea" name="message">Check out their short film "The Bell Ringer", and following the film, please consider contributing to the fund. If Royale makes their goal they'll animate a continuation of the story.
http://weareroyale.com/thebellringer</textarea>
<textarea class="email-textarea" style="display:none" name="messageCheck">Check out their short film "The Bell Ringer", and following the film, please consider contributing to the fund. If Royale makes their goal they'll animate a continuation of the story.
http://weareroyale.com/thebellringer</textarea>
</div>
<div class="email-send">
<input type="submit" class="spritebutton standardbutton sendbutton" value="">
</div>
</form>
<?php
}//true == $show_form <input type="submit" value="Send Form">
/*<a href="mailto:<?php echo $email_to; ?>?subject=Big%20News&body=Don\'t-get-your-bell-rung-by-an-old-lady-during-the-holiday-\#saggybells">Email Us</a>*/
?>
</div> <!-- /plaque-email-inner -->
</div> <!-- /plaque-email -->
<div class="email-fineprint t-small">
Questions / Concerns? Contact us at [email protected]
</div>
</body>
</html>