#!/usr/bin/perl use CGI qw(:standard); use DBI; # Connecting to the database $drh = DBI->install_driver("mysql"); #$dsn = "DBI:mysql:database=bewellcontentdb;host=bewellcontentdb.db.2081014.hostedresource.com"; #$dbh = DBI->connect($dsn,"bewellcontentdb","BeW3!!DB"); $dsn = "DBI:mysql:database=beweezfy_bewellworld;host=localhost"; $dbh = DBI->connect($dsn,"beweezfy_bewell","B3W3!!$"); require "./cgi/print_header_footer.cgi"; require "./cgi/shared_ads2.cgi"; $id = param('id'); $from = param('from'); if ($id =~ /^P/) { $directory_type = "practitioner"; $directory_type_uc = "Practitioner"; } else { $directory_type = "business referral"; $directory_type_uc = "Business Referral"; } if ($from eq "browse") { $browse_return = "
Browse more " . $directory_type . "s
\n"; } if ($from eq "search") { $browse_return = "Return to $directory_type search results
\n"; } my $sth = $dbh->prepare("select * from practitioner where id = '$id'"); $sth->execute(); while (my $ref = $sth->fetchrow_hashref()) { $id_from_db = $ref->{'id'}; $firstname = $ref->{'firstname'}; $lastname = $ref->{'lastname'}; $suffix = $ref->{'suffix'}; $business_name = $ref->{'business_name'}; $street_address = $ref->{'street_address'}; $city = $ref->{'city'}; $county = $ref->{'county'}; $state = $ref->{'state'}; $zipcode = $ref->{'zipcode'}; $online_description = $ref->{'online_description'}; $print_description = $ref->{'print_description'}; $phone = $ref->{'phone'}; $email = $ref->{'email'}; $website = $ref->{'website'}; $website_length = length ($website); $status_practitioner = $ref->{'status_practitioner'}; $status_site = $ref->{'status_site'}; $gift_certificate = $ref->{'gift_certificate'}; } $sth->finish(); my $sth = $dbh->prepare("select modality from modality where article_id = '$id' and modality_type = 3 "); $sth->execute(); while (my $ref = $sth->fetchrow_hashref()) { $modality_from_db = $ref->{'modality'}; push(@modalities, $modality_from_db); } $sth->finish(); print "Content-type: text/html\n\n"; print "\n\n"; print "\n"; print "\n"; if ($from eq "preview") { print <<"preview_style_end"; preview_style_end } $practitioner_name = "$firstname $lastname"; if ($suffix ne "") { $practitioner_name = $practitioner_name . ", $suffix"; } if ($practitioner_name ne "") { $practitioner_title = "$practitioner_name"; $practitioner_short_title = "$practitioner_name"; if ($business_name ne "") { $practitioner_title = $practitioner_title . " ($business_name)"; } } else { $practitioner_title = $business_name; $practitioner_short_title = $practitioner_title; } if ($practitioner_name ne "") { $practitioner_display = "$online_description
\n"; } $practitioner_data = $practitioner_data . "\n";
if ($street_address ne "") {
$practitioner_data = $practitioner_data . "$street_address
\n";
}
if ($city ne "") {
$practitioner_data = $practitioner_data . "$city ";
if ($state ne "") {
$practitioner_data = $practitioner_data . ", ";
}
}
if ($state ne "") {
$practitioner_data = $practitioner_data . "$state \n";
}
if ($zipcode ne "") {
$practitioner_data = $practitioner_data . "$zipcode\n";
}
$practitioner_data = $practitioner_data . "
\n";
if ($phone ne "") {
$practitioner_data = $practitioner_data . "$phone
\n";
}
if ($email ne "") {
($user,$host) = split(/@/,$email);
$practitioner_data = $practitioner_data . "
\n";
}
if (($website ne "") && ($website ne "http://")) {
if ($website_length < 60) {
$practitioner_data = $practitioner_data . "$website
\n";
}
else {
$practitioner_data = $practitioner_data . "Visit the ". $directory_type_uc . "'s Website
\n";
}
}
$practitioner_data = $practitioner_data . "
\n"; if ($modalities[0] ne "") { $practitioner_data = $practitioner_data . "Relevant areas:\n
Gift Certificates are available!
\n"; } if ($id_from_db eq "") { $practitioner_title = "$directory_type_uc $id is not a valid entry"; $practitioner_data = ""; $practitioner_display = "