-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppendedSignaturePage_email.php
More file actions
343 lines (324 loc) · 28.2 KB
/
AppendedSignaturePage_email.php
File metadata and controls
343 lines (324 loc) · 28.2 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Appended Signature Page</title>
<link rel="stylesheet" type="text/css" href="newcss.css" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" href="/favicon-32x32.png"/>
<link rel="icon" type="image/png" href="/favicon-16x16.png"/>
<link rel="manifest" href="/manifest.json" />
<link rel="mask-icon" href="/safari-pinned-tab.svg"/>
</head>
<body>
<?php
require_once 'vendor/autoload.php';
include('auth.php');
$signer_email = $_POST['signeremail'];
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["uploadedfile"]["name"]);
$uploadOk = 1; //this is used if the other if statements are used
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
if ($imageFileType != "pdf" && $imageFileType != "doc" && $imageFileType != "docx" && $imageFileType != "ppsx" && $imageFileType != "ppt" && $imageFileType != "pptx" && $imageFileType != "tif" && $imageFileType != "jpg" && $imageFileType != "jpeg" && $imageFileType != "png" && $imageFileType != "xls" && $imageFileType != "xlsx" && $imageFileType != "txt" && $imageFileType != "html" && $imageFileType != "gif") {
echo "Sorry, only doc, docx, pdf, ppsx, ppt, pptx, tif, jpg, jpeg, png, xls, <br />"
. "xlsx, txt, html, and gif are allowed at this point <br />";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
goto skip;
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $target_file)) {
echo "The file " . basename($_FILES["uploadedfile"]["name"]) . " has been uploaded. <br />";
} else {
echo "Sorry, there was an error uploading your file. <br />";
$uploadOk = 0;
goto skip;
}
}
// Instance of a client for you to use for calls
$client = new HelloSign\Client($api_key);
// Example call with logging for embedded requests
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle("Testing");
$request->setSubject('My First embedded signature request');
$request->setMessage('Awesome, right?');
$request->addSigner("$signer_email", 'Testing Signer');
//$request->setAllowDecline(true); //this isn't a thing yet
$request->addFile("$target_file");
rename($target_file, "$target_file.embSigReq");
// Turn it into an embedded request
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
// Send it to HelloSign
$response = $client->createEmbeddedSignatureRequest($embedded_request);
// Grab the signature ID for the signature page that will be embedded in the page
$signature_request_id = $response->signature_request_id;
$signatures = $response->getSignatures();
$signature_id = $signatures[0]->getId();
$createdHow = "appendedSignaturePage_email";
include('db.php');
// send email region
$sendgrid = new SendGrid($sendgrid_php_apikey);
$url = 'https://api.sendgrid.com/';
$pass = $sendgrid_php_apikey;
$params = array(
'to' => "$signer_email",
'toname' => "Testing Signer",
'from' => "radhack242@gmail.com",
'fromname' => "CirqlHR",
'subject' => "Please review and sign",
'html' => "<html>
<head>
<title></title>
<meta http-equiv = \"Content-Type\" content = \"text/html; charset=utf-8\" />
<meta name = \"viewport\" content = \"width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1\" />
<!--[if!mso]><!-->
<meta http-equiv = \"X-UA-Compatible\" content = \"IE=Edge\" />
<!-- <![endif] -->
<!--[if (gte mso 9)|(IE)]><style type = \"text/css\">
table {border-collapse: collapse;
}
table, td {mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {-ms-interpolation-mode: bicubic;
}
</style>
<![endif] -->
<style type = \"text/css\">body {
color: #000000;
}
body a {
color: #1188e6;
text-decoration: none;
}
p { margin: 0;
padding: 0;
}
table[class = \"wrapper\"] {
width:100%!important;
table-layout: fixed;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
img[class = \"max-width\"] {
max-width: 100%!important;
}
@media screen and (max-width:480px) {
.preheader .rightColumnContent,
.footer .rightColumnContent {
text-align: left!important;
}
.preheader .rightColumnContent div,
.preheader .rightColumnContent span,
.footer .rightColumnContent div,
.footer .rightColumnContent span {
text-align: left!important;
}
.preheader .rightColumnContent,
.preheader .leftColumnContent {
font-size: 80%!important;
padding: 5px 0;
}
table[class = \"wrapper-mobile\"] {
width: 100%!important;
table-layout: fixed;
}
img[class = \"max-width\"] {
height: auto!important;
}
a[class = \"bulletproof-button\"] {
display: block!important;
width: auto!important;
font-size: 80%;
padding-left: 0!important;
padding-right: 0!important;
}
/*2 columns */
#templateColumns{
width:100%!important;
}
.templateColumnContainer{
display:block!important;
width:100%!important;
padding-left: 0!important;
padding-right: 0!important;
}
}
</style>
<style type = \"text/css\">body, p, div { font-family: arial, sans-serif;
}
</style>
</head>
<body data-attributes = \"%7B%22dropped%22%3Atrue%2C%22bodybackground%22%3A%22%23FFFFFF%22%2C%22bodyfontname%22%3A%22arial%2Csans-serif%22%2C%22bodytextcolor%22%3A%22%23000000%22%2C%22bodylinkcolor%22%3A%22%231188e6%22%2C%22bodyfontsize%22%3A%2214px%22%7D\" style = \"min-width: 100%; margin: 0; padding: 0; font-size: 14pxpx; font-family: arial,sans-serif; color: #000000; background-color: #FFFFFF; color: #000000;\" yahoofix = \"true\">
<center class = \"wrapper\">
<div class = \"webkit\">
<table bgcolor = \"#FFFFFF\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"wrapper\" width = \"100%\">
<tbody>
<tr>
<td bgcolor = \"#FFFFFF\" valign = \"top\" width = \"100%\"><!--[if (gte mso 9)|(IE)]>
<table width = \"600\" align = \"center\" cellpadding = \"0\" cellspacing = \"0\" border = \"0\">
<tr>
<td>
<![endif] -->
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"outer\" data-attributes = \"%7B%22dropped%22%3Atrue%2C%22containerpadding%22%3A%220%2C0%2C0%2C0%22%2C%22containerwidth%22%3A600%2C%22containerbackground%22%3A%22%23FFFFFF%22%7D\" role = \"content-container\" width = \"100%\">
<tbody>
<tr>
<td width = \"100%\">
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" width = \"100%\">
<tbody>
<tr>
<td><!--[if (gte mso 9)|(IE)]>
<table width = \"600\" align = \"center\" cellpadding = \"0\" cellspacing = \"0\" border = \"0\">
<tr>
<td>
<![endif] -->
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" style = \"width: 100%; max-width:600px;\" width = \"100%\">
<tbody>
<tr>
<td align = \"left\" bgcolor = \"#FFFFFF\" role = \"modules-container\" style = \"padding: 0px 0px 0px 0px; color: #000000; text-align: left;\" width = \"100%\">
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"module preheader preheader-hide\" data-type = \"preheader\" role = \"module\" style = \"display:none !important; visibility:hidden; opacity:0; color:transparent; height:0; width:0;\" width = \"100%\">
<tbody>
<tr>
<td role = \"module-content\">
<p>
</p>
</td>
</tr>
</tbody>
</table>
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"module\" data-attributes = \"%7B%22dropped%22%3Atrue%2C%22child%22%3Afalse%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22containerbackground%22%3A%22%23ffffff%22%7D\" data-type = \"text\" role = \"module\" style = \"table-layout: fixed;\" width = \"100%\">
<tbody>
<tr>
<td bgcolor = \"#ffffff\" height = \"100%\" role = \"module-content\" style = \"padding: 0px 0px 0px 0px;\" valign = \"top\">
<h1 style = \"text-align: center;\"><span style = \"font-family:lucida sans unicode,lucida grande,sans-serif;\">Welcome to CirqlHR!</span></h1>
</td>
</tr>
</tbody>
</table>
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"wrapper\" data-attributes = \"%7B%22child%22%3Afalse%2C%22link%22%3A%22%22%2C%22width%22%3A%2286%22%2C%22height%22%3A%2286%22%2C%22imagebackground%22%3A%22%23FFFFFF%22%2C%22url%22%3A%22https%3A//marketing-image-production.s3.amazonaws.com/uploads/c36794c2bf0807db1235001886021c697a0f867e03707fe0edb5c3f46090eddc6530eabf5a08b1e6469707313ba494971b5d067a43dfdc46bc5964ef9a42c461.png%22%2C%22alt_text%22%3A%22CIRQULHR%22%2C%22dropped%22%3Atrue%2C%22imagemargin%22%3A%220%2C0%2C0%2C0%22%2C%22alignment%22%3A%22center%22%2C%22responsive%22%3Atrue%7D\" data-type = \"image\" role = \"module\" style = \"table-layout: fixed;\" width = \"100%\">
<tbody>
<tr>
<td align = \"center\" role = \"module-content\" style = \"font-size:6px;line-height:10px;background-color:#FFFFFF;padding: 0px 0px 0px 0px;\" valign = \"top\"><!--[if mso]>
<center>
<table width = \"86\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" style = \"table-layout: fixed;\">
<tr>
<td width = \"86\" valign = \"top\">
<![endif] --><span class = \"sg-image\" data-imagelibrary = \"%7B%22width%22%3A%2286%22%2C%22height%22%3A86%2C%22alt_text%22%3A%22CIRQULHR%22%2C%22alignment%22%3A%22%22%2C%22border%22%3A0%2C%22src%22%3A%22https%3A//marketing-image-production.s3.amazonaws.com/uploads/c36794c2bf0807db1235001886021c697a0f867e03707fe0edb5c3f46090eddc6530eabf5a08b1e6469707313ba494971b5d067a43dfdc46bc5964ef9a42c461.png%22%2C%22classes%22%3A%7B%22sg-image%22%3A1%7D%7D\"><img alt = \"CIRQULHR\" border = \"0\" class = \"max-width\" height = \"86\" src = \"https://marketing-image-production.s3.amazonaws.com/uploads/c36794c2bf0807db1235001886021c697a0f867e03707fe0edb5c3f46090eddc6530eabf5a08b1e6469707313ba494971b5d067a43dfdc46bc5964ef9a42c461.png\" style = \"color: rgb(0, 0, 0); text-decoration: none; font-family: Helvetica, arial, sans-serif; font-size: 16px; max-width: 86px !important; width: 86px; height: 86px;\" width = \"86\" /></span> <!--[if mso]>
</td></tr></table>
</center>
<![endif] --></td>
</tr>
</tbody>
</table>
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"module\" data-attributes = \"%7B%22dropped%22%3Atrue%2C%22borderradius%22%3A6%2C%22buttonpadding%22%3A%2212%2C18%2C12%2C18%22%2C%22text%22%3A%22CLICK%2520HERE%2520TO%2520SIGN%22%2C%22alignment%22%3A%22center%22%2C%22fontsize%22%3A16%2C%22url%22%3A%22%22%2C%22height%22%3A%22%22%2C%22width%22%3A%22%22%2C%22containerbackground%22%3A%22%23ffffff%22%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22buttoncolor%22%3A%22%231188e6%22%2C%22textcolor%22%3A%22%23ffffff%22%2C%22bordercolor%22%3A%22%231288e5%22%7D\" data-type = \"button\" role = \"module\" style = \"table-layout: fixed;\" width = \"100%\">
<tbody>
<tr>
<td align = \"center\" bgcolor = \"#ffffff\" style = \"padding: 0px 0px 0px 0px;\">
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"wrapper-mobile\">
<tbody>
<tr>
<td align = \"center\" bgcolor = \"#1188e6\" style = \"-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; font-size: 16px;\"><a class = \"bulletproof-button\" href = \"https://simple-php-example.herokuapp.com/reviewdocument.php?signature_id=$signature_id\" style = \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\">CLICK HERE TO SIGN</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"module footer\" data-attributes = \"%7B%22dropped%22%3Atrue%2C%22columns%22%3A1%2C%22padding%22%3A%2210%2C5%2C10%2C5%22%2C%22containerbackground%22%3A%22%23ffffff%22%7D\" data-type = \"footer\" role = \"module\" width = \"100%\">
<tbody>
<tr>
<td bgcolor = \"#ffffff\" style = \"padding: 10px 5px 10px 5px;\">
<table align = \"center\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" width = \"100%\">
<tbody>
<tr role = \"module-content\">
<td align = \"center\" class = \"templateColumnContainer\" height = \"100%\" valign = \"top\" width = \"100%\">
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" height = \"100%\" width = \"100%\">
<tbody>
<tr>
<td class = \"leftColumnContent\" height = \"100%\" role = \"column-one\" style = \"height:100%;\">
<table border = \"0\" cellpadding = \"0\" cellspacing = \"0\" class = \"module\" data-attributes = \"%7B%22dropped%22%3Atrue%2C%22child%22%3Afalse%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22containerbackground%22%3A%22%23ffffff%22%7D\" data-type = \"text\" role = \"module\" style = \"table-layout: fixed;\" width = \"100%\">
<tbody>
<tr>
<td bgcolor = \"#ffffff\" height = \"100%\" role = \"module-content\" style = \"padding: 0px 0px 0px 0px;\" valign = \"top\">
<div style = \"font-size:12px;line-height:150%;margin:0;text-align:center;\">This email was sent by: CirqlHR 944 Market St, Suite 500, San Francisco CA 94102 - Powered by alex@hellosign.com</div>
<div style = \"font-size:12px;line-height:150%;margin:0;text-align:center;\">To unsubscribe click: <a href = \"comingsoon\">here</a></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</td>
</table>
<![endif] --></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif] --></td>
</tr>
</tbody>
</table>
</div>
</center>
</body>",
);
$request = $url . 'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $sendgrid_php_apikey));
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response_email = curl_exec($session);
curl_close($session);
// print everything out
print_r($response_email);
echo '<br />';
echo '<a href="index.php">Click here to go home</a>';
skip:
// skip loop so this doesn't run when skip isn't used
if ($uploadOk === 0) {
echo '<br />';
echo '<a href="index.php">GO HOME YOU ARE DRUNK</a>';
}
?>
</body>
</html>