-
Notifications
You must be signed in to change notification settings - Fork 0
/
picture.csm
executable file
·43 lines (28 loc) · 1.1 KB
/
picture.csm
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
#!/usr/bin/perl
use lib "lib";
use strict;
use Profiles;
use template2;
use FCGI;
use CGI::Fast;
my ($dbh);
use POSIX qw(SIGTERM SIGINT SIGSEGV);
POSIX::sigaction(SIGTERM, POSIX::SigAction->new(\&fastQuit)) or die "Error setting SIGTERM handler: $!\n";
POSIX::sigaction(SIGINT, POSIX::SigAction->new(\&fastQuit)) or die "Error setting SIGINT handler: $!\n";
POSIX::sigaction(SIGSEGV, POSIX::SigAction->new(\&fastQuit)) or die "Error setting SIGSEGV handler: $!\n";
sub fastQuit {
warn "FASTQUIT CALLED FROM picture.csm. SIG@_";
exit(0);
}
while (my $cgi = new CGI::Fast) {
my $P = Profiles->new(dbh=>$dbh,query=>$cgi);
my $id = $P->{query}->param('id');
my $sth = $P->{dbh}->prepare("SELECT photos.userId,photos.id,handle FROM photos,profiles WHERE photos.id=$id and photos.userId=profiles.userId");
$sth->execute;
$P->{user}{photo} = $sth->fetchrow_hashref;
$sth->finish;
$P->{user}{photo}{contest} = $P->{query}->param('contestId') || 0;
$P->{user}{photo}{linkhandle} = $P->{util}->linkify($P->{user}{photo}{handle});
print $P->Header();
print processTemplate($P->{user},"picture.html");
}