#!/usr/bin/perl ########################################################################### # Reviews Iterface # # This program will be used to generate the page to view a review. # # (c) 2002 The Stigmata Organization ############################################################################ # Uses and Requires use lib qw( . ); use CGI; use CGI::Carp qw( fatalsToBrowser ); use DBI; use DTO::Site; use strict; # Run Main main(); # Sub It sub main { # Create CGI Object my $q = CGI->new(); # Create DTO Site Object my $dtos = DTO::Site->new($q); # Generate Page print $dtos->generate_top(); print $dtos->revnavbar(); print main_page($q); print $dtos->generate_bottom(); } sub main_page { # Passed Q my $q = shift; my $review_id = $q->param('review_id'); # HTML Variable my $html; # Header $html .= $q->h2("View Review"); # Check for Review ID if ($review_id == 0 || $review_id =~ /^\s*$/) { $html .= $q->b("An Error Has Occurred:") . $q->p; $html .= "Review ID has not been passed" . $q->p; return $html; } # Database Information my $database = "dtorg"; my $host = "wicked.stigmata.org"; my $data_source = "DBI:mysql:$database;host=$host"; my $username = "skadz"; my $password = "egenera"; my $dbh = DBI->connect( $data_source, $username, $password); if (!$dbh) { die "Can't connect to $data_source:" . $dbh->errstr. "\n"; } my $sth = $dbh->prepare(qq( SELECT snc_id, snc_type_id, snc_date, snc_title, snc_location, review_id FROM reviews, showsncds WHERE review_user_id = ? AND snc_id = review_snc_id ORDER BY review_id DESC )); $sth->bind_param(1, 1); $sth->execute || die "Unable to execute: " . $dbh->errstr; # Get Information Out if ($sth->rows() == 0) { $html .= $q->b("You have submitted no reviews"); } else { $html .= "