#!/usr/bin/perl
#ticket script
use warnings; 
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my $name = param("n");
my $email = param("e");
my $amount = param("a");
my $remarks = param ("r");

print header (), start_html("Presales Naturmystikk - Dordeduh, Absolutus, Tranceatla"), h1 ("presales Dordeduh, Absolutus, Tranceatla - 12 February 2017");
print '<body style="background-color: rgb(1, 1, 1); color: rgb(0, 0, 0); text-align: center"
 alink="#ee0000" link="#0000ee" vlink="#551a8b">
<div style="text-align: center; width: 960px; display: inline-block"><a
 name="banner"></a><img
 style="width: 960px; height: 200px;"
 src="http://www.niflheimpromotions.be/banner960x200.jpg" alt=""><br>
<div><span style="color: white;"><span
 style="font-family: Calibri;"><a style="color: white;"
 href="http://www.niflheimpromotions.be/">HOME ::
NIFLHEIM PROMOTIONS VZW</a>
&nbsp; | &nbsp;&nbsp;&nbsp;
<a style="color: white;"
 href="http://www.niflheimpromotions.be/naturmystikk">NATURMYSTIKK</a>&nbsp;&nbsp;
| &nbsp;&nbsp;&nbsp;<a style="color: white;"
 href="http://www.niflheimpromotions.be/eveofgrief">EVE OF GRIEF</a></span></span><span
 style="color: white;"></span><br>
<div>
<div style="text-align: center;">
<div style="text-align: center; height: 659px;"><br>
<div style="height: 612px; margin-left: 65px; width: 822px;"
 class="#frame1"><span
 style="color: white; font-family: Calibri;">Presale Form</span><br>
<br>
<p
 style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri; margin-left: 12px; height: 37px; width: 804px;"
 align="justify"> <font color="#c0c0c0" size="2"> Order your tickets for Naturmystikk -  Dordeduh, Tranceatla, Absolutus @ Asgaard, Gent:<br>
Any questions, please contact presales@niflheimpromotions.be</font></p>
<p
 style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri; margin-left: 12px; height: 37px; width: 804px;"
 align="justify"><font color="#c0c0c0" size="2">
';
if ($name, $email, $amount)
    {   my $payment = $amount * 12;
        my $text = "Beste $name,
        
Beste $name, we noteerden uw naam en aantal tickets ($amount). Om de presale te vervolledigen, gelieve het bedrag van $payment Euro ($amount x 12) te storten op rekening IBAN: BE58 7390 1261 7879 (BIC: KREDBEBB) op naam van Niflheim Promotions VZW. Overschrijvingen worden minstens 2-wekelijks gecontroleerd. Hierop zal een e-ticket verstuurd worden om uw presale te bevestigen. Nifheim Promotions beschikt niet over een barcode systeem. Daarom worden namen op de gastenlijst geschreven. Toegang wordt verschaft na eenvoudig vertoon van identiteitskaart (of rijbewijs, SIS-kaart,…). Het E-ticket dient dan ook slechts als formele bevestiging van de presale. Bedankt om dit optreden mee mogelijk te maken!
Je gaf volgende opmerking: \'$remarks\'. Zonder tegenbericht komt dit in orde.

Niflheim Promotions VZW";
        my $texthtml = "<br><br>Beste $name, <br><br>

We noteerden uw naam en aantal tickets ($amount). Om de presale te vervolledigen, gelieve het bedrag van $payment Euro ($amount x 12) te storten op rekening IBAN: BE58 7390 1261 7879 (BIC: KREDBEBB) op naam van Niflheim Promotions VZW. 
Overschrijvingen worden minstens 2-wekelijks gecontroleerd. Hierop zal een e-ticket verstuurd worden om uw presale te bevestigen. Nifheim Promotions beschikt niet over een barcode systeem. Daarom worden namen op de gastenlijst geschreven. 
Toegang wordt verschaft na eenvoudig vertoon van identiteitskaart (of rijbewijs, SIS-kaart,…). Het E-ticket dient dan ook slechts als formele bevestiging van de presale. 
Je gaf volgende opmerking: \'$remarks\'. Zonder tegenbericht komt dit in orde. <br><br>

Bedankt om dit optreden mee mogelijk te maken!
<br><br>
Niflheim Promotions VZW";
        open (MAIL, "|/usr/sbin/sendmail -t -oi") or 
        die "Can't fork for sendmail: $!\n";
        print MAIL "From: presales\@niflheimpromotions.be\n";
        print MAIL "To: $email\n";
        print MAIL "cc: niflheim.contact\@gmail.com, presales\@niflheimpromotions.be\n";
        print MAIL "Subject: Your presale for Naturmystikk w\  Dordeduh, Tranceatla, Absolutus +1 \n\n";
        print MAIL $text;
        close(MAIL);
        print $texthtml;
    }
    else {
        print hr, start_form, "Please enter your full name, email adress and amount of tickets you want to order. If you have any remarks you can mention these (for example the names of the other visitors, in case they might not arrive at the same time)", br, 
        "Your name (e.g. John Doe)\: ", textfield ("n", ""), br,
        "Your e-mail adres (e.g. account\@gmail.com)\: ", textfield ("e",""), br,
        "Amount of tickets (e.g. 2)\: ", textfield (-name => "a", -size => 2, -maxlenght =>2), br,
        "Remarks\: ", textfield (-name => "r", -value => 'I have no remarks', -size => 100), br;
        print submit(-name=>"post",-value=>"Order Tickets");
        print end_form, hr; 
        }
print '</font></p>
<p
 style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri; margin-left: 12px; width: 450px; height: 37px;"
 align="justify"></p>
<p
 style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri; margin-left: 12px; width: 450px; height: 400px;"
 align="justify"></p>
</div>
</div>
</div>
<div style="text-align: left;"><font color="#808080"
 face="Verdana" size="1"><big><span
 style="font-family: Calibri;">Site Copyright © 2017</span><span
 style="font-family: Calibri;"> Niflheim Promotions VZW</span><span
 style="font-family: Calibri;"><br>
Website designed, owned and maintained by Niflheim Promotions VZW</span></big></font></div>
</div>
</div>
</div>
</body>';
print end_html (); 

