#!/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("Onrust tribute pt. 2 w/ ANTIMATTER (full band), 40 WATT SUN, Leafblade"), h1 ("presales 40 Watt Sun & Antimatter - 12th of April 2014");
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 ANTIMATTER (full band), 40 WATT SUN, Leafblade via bank transfer: <br>
Any questions, please contact presales@niflheimpromotions.be <br> <br>
There are NO administration costs.</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 * 16;
        my $text = "Beste $name,

We noted your name and amount of tickets ($amount). The door tickets are reserved now, you can pay them at the entrance on the day of the concert. Please mention your name at the entrance.
You gave the following remarks: \'$remarks\'. If not stated otherwise, this will be ok.

Thanks for making this concert possible. 

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

We noted your name and amount of tickets ($amount). The door tickets are reserved now, you can pay them at the entrance on the day of the concert. Please mention your name at the entrance.
You gave the following remarks: \'$remarks\'. If not stated otherwise, this will be ok. <br><br>

Thanks for making this concert possible. 

<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 Onrust tribute pt. 2 w/ ANTIMATTER, 40 WATT SUN, Grown Below, Leafblade \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 (); 

