#! /usr/local/bin/perl #------------------------------------------------------------------------------- # Author: Richard Neal # Date: Aug 1, 2008 # Purpose: For use with Kodak support email. #------------------------------------------------------------------------------- # modification history # first version: 9-10-07 # Changed location of AIO english # 6-11-08 Added new directory structure for use with new translated Kodak support email # 8-06-08 Added Digital Display Software # 8-12-08 Revised code for counter added creation of counter if doesn't exist # 9-09-08 Revised code for counter removed leading 0 # 9-17-08 Added Theatre HD Player # 9-19-08 Added Log stopped counter # 9-25-08 Added Redirect logging # 9-25-08 Added UTF-8 header and remove Unicode::UTF8simple # 2-06-09 Added Chemical # 2-25-09 Added Qualex # 2-27-09 Added AIO Beta # 3-04-09 Added Chemical Silver # 3-16-09 Added Corperate # 5-14-09 Added PETCTA and PackMat changed chemical dir to marketing # 7-28-09 Added Finnish,Greek, and Swedish reddirect to English # 8-11-09 Added TPX # 8-11-09 Added KCR # 8-11-09 Added AgX # 1-26-10 Added new software directory replaced all EasyShare, Custom Creations, and Digital Display software with one template # 1-26-10 Added Share Button App # 1-26-10 Added KCRA = APerez # 4-19-10 Moved log to TKM Logs # 4-28-10 Added KPC = Kodak Professional Collections # 11-04-11 Added FBA = Face Book App # 06-22-12 Added Repair = Retail products repair RNT B2B # 10-24-12 Added DMA # 04-11-13 Changed log file location for new server # 04-16-13 Changed use LWP for proxy. Access the underlying LWP::UserAgent object and set the proxy. LWP::Simple exports the $ua variable # 04-30-13 Added binmode STDOUT, ":utf8" for UTF8 issues # 10-28-13 Changed proxy from proxy1-snj.us.kodak.com to proxy1.kodak.com:81 because server move from AT&T # include required libraries use strict; #use LWP::Simple qw(!head);# then only CGI.pm defines a head() use LWP::Simple qw(!head $ua get ); use CGI qw( :standard); #use Unicode::UTF8simple; use Net::SMTP; $|++; # force auto flush of output buffer #$ua->proxy( 'http', 'http://proxy1-snj.us.kodak.com:81' ); $ua->proxy( 'http', 'http://proxy1.kodak.com:81' ); my ($content,$formurl,$key,$referer,%forms,%parms,$uref,$emailform,$lang,$urlredirect); ######################################################################## #program starts here ######################################################################## #$uref = new Unicode::UTF8simple; $referer=referer(); #Load forms and locations %forms = ('accessories','accessory/accessory_email', 'all-in-one printers','aio/aiop_email', 'aiopb','aio/aiopb_email', 'agx','marketing/agx_email', 'custom creations software','software/sw_email', 'corp','corp/corporate_email', 'digital cameras','dc/dc_email', 'digital picture frames','dpf/dpf_email', 'digital display software','software/sw_email', 'easyshare gallery','gallery/gallery_email', 'easyshare software','software/sw_email', 'film','film/film_email', 'film cameras','filmcamera/filmcamera_email', 'inkjet paper','inkjet/inkjet_email', 'miscellaneous consumer products','other/other_email', 'photochemicals & photographic papers','photopaper/photopaper_email', 'photo printers','printer/printer_email', 'printer & camera docks','dock/dock_email', 'projectors','projector/projector_email', 'kodak store','store/store_email', 'qualex','qualex/qualex_email', 'share button app','software/sw_email', 'theatre hd player','other/other_email', 'coattest','marketing/coattest_email', 'silver','marketing/silver_email', 'packmat','marketing/packmat_email', 'petcta','marketing/petcta_email', 'specialty','marketing/chem_email', 'kcr','kcr/kcr_email', 'kcra','kcr/kcra_email', 'kpc','kpc/kpc_email', 'fba','fba/fba_email', 'dma','dma/dma_email', 'repair','repair/repair_email', 'tpx','tpx/tpx_email'); #Get parameters to populate the form %parms = &getfields(); #set parms to lower case $emailform = lc($parms{'contactUsProductFamily'}); $lang = lc($parms{'lang'}); #set default language #if ($parms{'lang'} eq "") {$parms{'lang'} = "en";} if ($lang eq "" or $lang eq "el" or $lang eq "fi" or $lang eq "sv") {$lang = "en";} #Build URL or redirect if (-e "$forms{$emailform}_$lang.html") { $formurl = "http://$ENV{'HTTP_HOST'}/email/$forms{$emailform}_$lang.html";} else {$urlredirect = &url_redirect; &write_log; exit;} #print redirect($formurl); #$content = "Content-type: text/html\n\n"; #$content .= "Topic = $parms{'tc'}
"; #$content .= "Search History = $parms{'sh'}
"; #$content .= "Answer Viewed = $parms{'av'}
"; #$content .= "Language = $parms{'lg'}
"; #$content .= "Form URL = $formurl
"; #$content .= "referer = $referer
"; #print $content; #$seachtext = $parms{'searchText'}; #$seachtext =~ s/[\"\']//g; #$answerViewed = $parms{'answerViewedTitle'}; #$answerViewed =~ s/[\"\']//g; #$content = "Content-type: text/html\n\n"; #my $tempcontent = get($formurl); binmode STDOUT, ":utf8"; $content = header(-charset=>'UTF-8'); $content .= get($formurl); #$content .= $convcontent; $content =~s//$parms{'searchText'}/gi; $content =~s//$parms{'answerViewedTitle'}/gi; $content =~s//$parms{'globalPageParams'}/gi; #$content =$uref->fromUTF8("iso-8859-1",$content); print $content; &write_log; #&write_Counter_log; #$content =~s///gi; #getfields #------------------------ #Uses the the CGI.pm modules to get name/value pairs from the form; sub getfields { my (%Config,@names,$name); %Config = ('contactUsProductFamily','','searchText','','answerViewedTitle','','globalPageParams','','lang',''); @names = keys(%Config); #read in all the parameter names foreach $name (@names) { $Config{$name} =param($name); } return %Config; } sub url_redirect { my $template_page; my $redirectlocation = "http://kodak.com/go/contact"; $template_page = header; $template_page .= "\n\n\n\n