-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
112 lines (102 loc) · 3.41 KB
/
index.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
<!--
vstupar.php
Version: 0.9
Copyright 2015 Petr Studený <dosmanak@centrum.cz>
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 2 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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Vstupařův průvodce večerem</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta content='width=device-width, initial-scale=0.7, maximum-scale=0.9, user-scalable=0' name='viewport' />
<link rel="stylesheet" href="style.css" type="text/css">
<script src="concertsApp.js" type="text/javascript"></script>
</head>
<body onload="Evening('concerts')">
<div id="concerts">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
//dos require 'class.phpmailer.php';
$datajson = ($_POST["data"]);
$data = json_decode($_POST["data"],true);
//var_dump($data);
$body = '<pre>';
setlocale(LC_TIME, "cs_CZ.UTF-8");
$body .= "Vstupné do JazzDocku za ".strftime("%A %d. %m. %G %R\n");
$total = 0;
foreach ($data as $key => $value) {
$body .= urldecode($value['title']);
$body .= ":\n";
$body .= "\tCena:\tPočet:\tCelkem\n";
$sum = 0;
for ($i = 0; ($i < count($value['prices'])); $i++)
{
if ($value['counts'][$i] != 0)
{
$body .= "\t".$value['prices'][$i];
$body .= "\t".$value['counts'][$i];
$body .= "\t".$value['counts'][$i]*$value['prices'][$i];
$sum += $value['counts'][$i]*$value['prices'][$i];
$body .= "\n";
}
}
$body .= "\t\tSoučet:\t$sum\n";
$total += $sum;
}
$body .= "Součet za celý večer:\t$total";
$body .= '</pre>';
echo $body;
$to = ($_POST["mailto"]);
if (filter_var($to, FILTER_VALIDATE_EMAIL))
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: =?utf-8?Q?Vstupa=C5=99=20JZD?= <vstupar@jazztecetera.cz>'. "\r\n";
if ( mail($to, 'JZD Vstupné '.strftime('%d.%m.%G'), $body, $headers) )
{
echo 'E-mail byl odeslán.';
} else {
echo 'E-mail nebyl odeslán';
}
} else {
echo 'E-mailová adresa není ve správném formátu.';
}
//$to = "Petr Studeny <dosmanak@centrum.cz>";
//dos $mail = new PHPMailer;
//dos $mail->isMail();
//dos $mail->setFrom('vstupar@jazztecetera.cz', 'Vstupar JZD');
//dos $mail->addAddress($to);
//dos $mail->Subject = 'JZD Vstupné '.strftime('%d.%m.%G');
//dos $mail->msgHTML($body);
//dos if (!$mail->send()) {
//dos echo "Chyba při odesílání: " . $mail->ErrorInfo;
//dos } else {
//dos echo "E-mail odeslán na ".$to."!\n".$mail->ErrorInfo;
//dos }
}
else
{
}
?>
</div>
<div class="footer">
<div id="eveningTotal"></div>
<div id="sendMail"></div>
<div id="resetCookies"></div>
</div>
</body>
</html>