-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess.php
103 lines (78 loc) · 3.3 KB
/
process.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
<?php
// Zend library include path
set_include_path("/home/ubuntu/sites/jedarchive/lib/ZendFramework-1.11.11-minimal/library");
include_once('lib/Google_Spreadsheet/Google_Spreadsheet.php');
require_once 'Zend/Mail/Transport/Smtp.php';
require_once 'Zend/Mail.php';
// Confirmation mail function
function send_mail($language, $n, $e) {
// configure Zend mail
$smtpServer = 'smtp.gmail.com';
$username = '[email protected]';
$password = 'edwin2011';
$config = array('ssl' => 'tls',
'auth' => 'login',
'username' => $username,
'password' => $password);
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
$mail = new Zend_Mail('UTF-8');
$mail->setFrom('[email protected]', 'Jdarchive.org Staff');
$mail->addTo($e, $n);
$subject;
$message;
if ($language == 'en') {
$subject = 'Jdarchive Alpha registration confirmation';
$message =
"Thank you for your interest in the Alpha prototype of our Digital Archive of Japan's 2011 Disasters. We will gradually roll out access to the interface in the coming days and weeks to allow interested visitors to provide feedback as we improve the archive.
When we are able to provide you with access, you will receive a separate email with login information and more details about the current features of the archive interface, as well as its limitations and upcoming additions.
Sincerely,
The Jdarchive.org Staff
http://jdarchive.org/";
}
else {
$subject = 'ご登録ありがとうございます';
$message =
'2011年東日本大震災デジタルアーカイブ・試作モデルalphaにご関心をお持ち下さりありがとうございます。このインターフェースへアクセスして頂ける人数は数日間から数週間をかけて段階的に拡大され、アーカイブが改良される過程において皆様からご意見・ご要望を頂けるようになります。
アクセスの準備が整いましたら、このメールとは別にメッセージが届き、ログイン方法や、現在のアーカイブ・インターフェースが可能にすることに関するより詳しい情報をご覧になることができます。同時に、制約及び追加される予定の機能についての説明もございます。
皆様のご参加に深く感謝申し上げます。
2011年東日本大震災デジタルアーカイブ・スタッフ一同
http://jdarchive.org/';
}
$mail->setSubject($subject);
$mail->setBodyText($message);
// send
$mail->send($transport);
}
$u = "[email protected]";
$p = "edwin2011";
$ss = new Google_Spreadsheet($u,$p);
$ss->useSpreadsheet("prototype applicants");
$name = $_POST["name"];
$email = $_POST["email"];
$lang = $_POST["language"];
$date = date("m-d-y");
$row = array
(
"name" => $name,
"email" => $email,
"dateapplied" => $date
);
// successful add to spreadsheet
if ($ss->addRow($row)) {
if ($lang === 'English') {
send_mail('en', $name, $email);
echo "Thank you for registering.<br />Confirmation email sent.";
}
else {
send_mail('jp', $name, $email);
echo "ご登録ありがとうございます<br />Eメールをご確認下さい";
}
}
// unsuccessful
else {
if ($lang == 'English')
echo "Error: Unable to Submit";
else
echo "サーバーエラーがあります";
}
?>