|
|

Hello and welcome to the new Ireland First! website.
This site last updated March
28th 2002
|
If you are a new visitor, Welcome! Have a
look around this website. I'm sure you'll find something worthwhile.
If you are a returning visitor, click
"what's new" link below to discover changes to this website since your last
visit. |
Note: a Javascript
enabled web browser is required to navigate this webpage. Works best in
Internet Explorer. You can download the latest version from the Microsoft site
by
clicking here. |
This website is under construction. Check
back often to see what's new at this
webpage. |
If you would like to be notified by email
about important changes and updates to this website, fill out the
feedback form. |
|
|
#!/usr/bin/perl
# Change the above line to your servers path to perl
########
# Don't edit below this line or you will die.
########
if ($0=~m#^(.*)(\\|/)#) { $cgidir = $1; }
else { $cgidir = `pwd`; chomp $cgidir; }
$scriptdir = $cgidir;
$scripturl = $ENV{'SCRIPT_NAME'};
$datadir = "$cgidir/data";
require "$scriptdir/settings.pl";
&getinput;
&getcookies;
if ($QUERY{viewcomments}) {
&viewcomments($QUERY{poll});
} elsif ($QUERY{index}) {
&pollindex;
} else {
if ($QUERY{vote}) {
&vote($QUERY{poll}, $QUERY{vote});
}
&loadpoll($QUERY{poll});
&viewpoll;
}
print "Content-type:text/html\n\n";
$out =~ s/\[%info%\]/$info/g;
$out =~ s/\[%pollid%\]/$QUERY{poll}/g;
$out =~ s/\[%polltitle%\]/$polldata{'title'}/g;
$out =~ s/\[%scriptname%\]/$ENV{'SCRIPT_NAME'}/g;
print $out;
sub pollindex {
}
sub viewcomments {
open(POLLDATAC, "$datadir/$_[0].comment.txt") or &fatalerr('Cannot access poll comment data file.');
@commentdata = ;
close(POLLDATAC);
$out .= $template{'ctop'};
foreach (@commentdata) {
chomp($_);
($poster, $comment, $time, $ip) = split(/``/, $_);
$date = &gettime($time);
$temp = $template{'crepeat'};
$temp =~ s/\[%cdate%\]/$date/g;
$temp =~ s/\[%cposter%\]/$poster/g;
$temp =~ s/\[%comment%\]/$comment/g;
$out .= $temp;
}
$out .= $template{'cbottom'};
}
sub fatalerr {
print "Content-type:text/html\n\n";
print "Error: $_[0]";
exit;
}
sub checkvote {
open(POLLIPDATA, "$datadir/$_[0].ip.txt") or &fatalerr('Cannot access poll ip data file.');
$ipdata = join(':',());
close(POLLIPDATA);
if ($ipdata =~ /$ENV{REMOTE_ADDR}/ or $cookies{"$cookiename$_[0]"}) {
return 1;
} else {
return 0;
}
}
sub checkban {
open(BANDATA, "$datadir/bans.txt") or &fatalerr('Cannot access ban data file.');
$bans = join(':',());
close(BANDATA);
if ($bans =~ /$_[0]/) {
return 1;
} else {
return 0;
}
}
sub vote {
my (@polldata, $entrynum, $handle, $count);
if (&checkvote($_[0])) {
$info = "You have already voted on this poll, you may not vote again.";
} elsif (&checkban($ENV{REMOTE_ADDR})) {
$info = "You are banned from voting or adding comments to this poll.";
} else {
if ($enablecomments && $QUERY{comments}) {
$QUERY{comments} =~ s/\n/ /g;
$QUERY{comments} =~ s/\r//g;
$QUERY{commentsname} = "Anonymous" if (!$QUERY{commentsname} or $QUERY{commentsname} eq "Your Name");
$QUERY{comments};
if ($enableswearfilter) {
foreach (@swearfilter) {
$word = "$_";
$length = length($word);
$replace = '*' x $length;
$QUERY{comments} =~ s/$word/$replace/egi;
$QUERY{commentsname} =~ s/$word/$replace/egi;
}
}
# Strip out any html in the messages
$QUERY{comments} =~ s/</g;
$QUERY{comments} =~ s/>/>/g;
$QUERY{commentsname} =~ s/</g;
$QUERY{commentsname} =~ s/>/>/g;
open(POLLDATA, ">>$datadir/$_[0].comment.txt") or &fatalerr('Cannot access poll comment data file.');
print POLLDATA "$QUERY{commentsname}``$QUERY{comments}``" . time . "``$ENV{REMOTE_ADDR}\n";
close(POLLDATA);
}
$info = "Vote registered.";
open(POLLDATA, "$datadir/$_[0].dat.txt") or &fatalerr('Cannot access poll data file.');
@polldata = ;
close(POLLDATA);
foreach (@polldata) {
chomp($_);
($entrynum, $handle, $count) = split(/``/, $_);
$polldatav{$entrynum} = $count;
$pollhandlev{$entrynum} = $handle;
}
if ($QUERY{'vote'} == 0 or !exists $pollhandlev{$QUERY{'vote'}}) {
&fatalerr('Invalid vote id.');
}
$polldatav{$QUERY{'vote'}}++;
$polldatav{'0'}++;
open(POLLDATA, ">$datadir/$_[0].dat.txt") or &fatalerr('Cannot access poll data file.');
foreach (sort keys %polldatav) {
print POLLDATA "$_``$pollhandlev{$_}``$polldatav{$_}\n";
}
close(POLLDATA);
open(POLLIPDATA, ">>$datadir/$_[0].ip.txt") or &fatalerr('Cannot access poll ip data file.');
print POLLIPDATA "$ENV{REMOTE_ADDR}\n";
close(POLLIPDATA);
print "Set-Cookie:$cookiename$_[0]=voted; expires=Thu, 20-May-3001 10:10:10 GMT";
}
}
sub viewpoll {
my ($temp1, $temp2);
if (&checkvote($QUERY{poll})) { $voted = 1; } else { $voted = 0;}
$out .= $template{'top'};
# uses %pollhandle instead of %polldata because the title and total are in %polldata
foreach (sort numsort keys %pollhandle) {
if ($voted | $QUERY{viewresults}) {
if ($polldata{'total'} == 0) {
$temp1 = 0;
} else {
$temp1 = sprintf("%.2f", $polldata{$_} / $polldata{'total'}) * 100;
}
$temp2 = 100 - $temp1;
$repeat2 = $template{'repeat2'};
$repeat2 =~ s/\[%option%\]/$pollhandle{$_}/g;
$repeat2 =~ s/\[%optionid%\]/$_/g;
$repeat2 =~ s/\[%optionvotes%\]/$polldata{$_}/g;
$repeat2 =~ s/\[%percentage%\]/$temp1/g;
$repeat2 =~ s/\[%-percentage%\]/$temp2/g;
$out .= $repeat2;
} else {
$repeat1 = $template{'repeat1'};
$repeat1 =~ s/\[%option%\]/$pollhandle{$_}/g;
$repeat1 =~ s/\[%optionid%\]/$_/g;
$out .= $repeat1;
}
}
if (!$voted && !$QUERY{viewresults}) {
$out .= $template{'commentform'} if $enablecomments;
$out .= $template{'submit'};
}
$template{'bottom'} =~ s/\[%polltotal%\]/$polldata{'total'}/g;
$out .= $template{'bottom'};
}
sub loadpoll {
if (!$_[0]) {
opendir(DIR, "$datadir") or &fatalerr('Cannot open data directory.');
@polls = grep(/\.dat\.txt$/, readdir(DIR));
closedir(DIR);
@polls = reverse sort numsort @polls;
$polls[0] =~ s/\.dat\.txt//;
$_[0] = $polls[0];
}
my (@polldata, $entrynum, $handle, $count);
open(POLLDATA, "$datadir/$_[0].dat.txt") or &fatalerr('Cannot access poll data file.');
@polldata = ;
close(POLLDATA);
foreach (@polldata) {
chomp($_);
($entrynum, $handle, $count) = split(/``/, $_);
if ($entrynum == 0) {
$polldata{title} = $handle;
$polldata{total} = $count;
} else {
$polldata{$entrynum} = $count;
$pollhandle{$entrynum} = $handle;
}
}
}
sub getinput {
my( @pairs, $pair, $name, $value );
read(STDIN, $value, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $value);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
@pairs = split(/&/, $ENV{QUERY_STRING});
foreach $pair (@pairs) {
($name,$value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
$QUERY{$name} = $value;
}
}
sub getcookies {
my (@cookies, $name, $value, $cookie);
if ($ENV{'HTTP_COOKIE'}) {
@cookies = split (/;/, $ENV{'HTTP_COOKIE'});
foreach $cookie (@cookies) {
($name, $value) = split(/=/, $cookie);
$name =~ s/ //g;
$cookies{$name} = $value;
}
}
}
sub numsort {
if ($a > $b) {
return 1;
} elsif ($a < $b) {
return -1;
} else {
return 0;
}
}
sub gettime {
if (!@_[0]) { $time = time(); } else { $time = @_[0]; }
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time);
$mon_num = $mon+1;
$saveyear = ($year % 100);
$year = 1900 + $year;
$mon_num = "0$mon_num" if ($mon_num < 10);
$mday = "0$mday" if ($mday < 10);
$saveyear = "0$saveyear" if ($saveyear < 10);
return ($mon_num . "/" . $mday . "/" . $saveyear);
}
|
"I speak to my people, and I speak in my
people's name to the masters of my people. I say to my people that they are
holy, that they are august, despite their chains, That they are greater than
those that hold them, and stronger and purer, That they have but need of
courage, and to call on the name of their God, God the unforgetting, the dear
God that loves the peoples For whom He died naked, suffering shame. And I say
to my people's masters: Beware, Beware of the thing that is coming, beware of
the risen people, Who shall take what ye would not give. Did ye think to
conquer the people, Or that Law is stronger than life and than men's desire to
be free? We will try it out with you, ye that have harried and held, Ye that
have bullied and bribed, tyrants, hypocrites, liars!" - Excerpt from "The Rebel" by Patrick Pearse.
"Self-government is our right, a
thing born in us at birth. A thing no more to be doled out to us or withheld
from us by another people than the right to life itself - than the right to
feel the sun or smell the flowers, or to love our kind. If it be treason to
fight against such an unnatural fate as this, then I am proud to be a rebel,
and shall cling to my 'rebellion' with the last drop of my blood." - Roger
Casement made from the dock of the Old Bailey.
This page has had over 38,000 visitors since 22nd
of February `97 when I first put a counter on this website. Today ,12th March
2002, I've decided to reset the counter to 0 again.
Website design copyright © Ray Cantillon -
All rights reserved.
 
              |