#!/usr/local/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 - Mortifera, Total Self Hatred, Toorn, Murw - The Frontline, Gent"), h1 ("presales Mortifera/TotalSelfHatred 5 December 2013");
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</a>
&nbsp; | &nbsp;&nbsp;&nbsp;
<a style="color: white;"
 href="http://www.niflheimpromotions.be/">NATURMYSTIKK</a>&nbsp;&nbsp;
| &nbsp;&nbsp;&nbsp;<a style="color: white;"
 href="http://www.niflheimpromotions.be/">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 - Mortifera, Total Self Hatred, Toorn, Murw @ The Frontline, 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 * 10;
        my $text = "Beste $name,
        
Beste $name, we noteerden uw naam en aantal tickets ($amount). De voorverkoop is intussen afgesloten, enkel nog een reservatie kon gemaakt worden.
Je gaf volgende opmerking: \'$remarks\'. Zonder tegenbericht komt dit in orde.

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

We noteerden uw naam en aantal tickets ($amount). De voorverkoop is intussen afgesloten, enkel nog een reservatie kon gemaakt worden. 
Je gaf volgende opmerking: \'$remarks\'. Zonder tegenbericht komt dit in orde. <br><br>

Bedankt om dit optreden mee mogelijk te maken! Tot donderdag!
<br><br>
Niflheim Promotions";
        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\ Mortifera, Total Self Hatred, Toorn, Murw \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 © 2013</span><span
 style="font-family: Calibri;"> Niflheim Promotions</span><span
 style="font-family: Calibri;"><br>
Website designed, owned and maintained by Niflheim Promotions</span></big></font></div>
</div>
</div>
</div>
</body>';
print end_html (); 

