#!/usr/bin/perl ########################################################################### # Reviews Iterface # # This program will be used to generate the top level reviews page. # # (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; # 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 review_id, snc_title, snc_date, type_info, user_name, user_email FROM users, showsncds, reviews, snctypes WHERE user_id = review_user_id AND snc_id = review_snc_id AND type_id = snc_type_id )); $sth->execute || die "Unable to execute: " . $dbh->errstr; $dbh->disconnect; # HTML Var my $html; # HTML Page Info $html .= $q->h2("Reviews Interface"); $html .= "This is the main page for reviews. This includes reviews of "; $html .= "both shows and albums. From this area you will be able to "; $html .= "view reviews as well as enter your own."; $html .= $q->p; # Past Ten Reviews my @reviews = ('x','y','z'); $html .= $q->b("Latest 10 Reviews") . $q->p; $html .= "
    \n"; while (my $ref = $sth->fetchrow_hashref()) { $html .= $q->li($ref->{'snc_title'} . " by " . $ref->{'user_name'}); } $sth->finish; $html .= "
\n"; $html .= $q->p; # Search Form $html .= $q->startform(); $html .= $q->b("Search Reviews:") . $q->br; $html .= $q->textfield( -name=> 'search', -size=>50); $html .= $q->p; $html .= $q->submit(-name=>' Search Reviews '); $html .= $q->endform(); # Return Page return $html; }