--- contact.php 2001/02/28 14:14:10 1.2 +++ contact.php 2001/10/01 14:05:16 1.13 @@ -6,46 +6,58 @@ $smarty->assign( array ( Title=>"Pliva d.d." ) ); -$section=str_replace(".php","",basename($PHP_SELF)); -$smarty->assign("section",$section); - $main_file=$section; - -$title="CONTACT US"; -$lpic="cont"; $lext=".jpg"; -$mpic="contactus.gif"; +include("section.inc"); $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); -$from=str_replace(".php","",basename($HTTP_REFERER)); +if (! isset($from) || $from == "") { + $from=str_replace(".php","",basename($HTTP_REFERER)); + if (strstr($from,"?")) $from=substr($from,0,strpos($from,"?")); + if ($from == $HTTP_HOST || $from=="www.pliva.hr") $from="index"; +} + +$email="webmaster@pliva.hr"; // default $sth = $dbh->prepare("select email from emails where referer='$from' limit 1"); $sth->execute(); -$email_to="webmaster@pliva.hr"; if ($row=$sth->fetchrow_hash()) { - $email_to=$row[email]; + $email=$row[email]; +} else { + $sth = $dbh->prepare("select email from emails,menu where menu.section=referer and url like '$from%'"); + $sth->execute(); + if ($row=$sth->fetchrow_hash()) { + $email=$row[email]; + } } -$sth = $dbh->prepare("select iso,name from countries order by iso"); +$email=str_replace("\n","",$email); +$email=str_replace(" ","",$email); +$email_val=explode(",",$email); + +$sth = $dbh->prepare("select iso,name from countries order by name"); $sth->execute(); while ($row=$sth->fetchrow_hash()) { $countries[]=$row; } $smarty->assign(array(countries=>$countries, - email_to=>$email_to, + email_val=>$email_val, )); include("common.inc"); -$main=$smarty->fetch("$main_file.tpl"); + +if (isset($mailto) && check_required()) { + $main="Your comment is sent to $mailto. Thank you."; + include("quoted-printable.inc"); + iso_mail("$fullname ($country) <$mailfrom>",$mailto,$subject,$comment); +# $main.="
$mailto $fullname $mailfrom $country $subject $comment
"; +} else { + $main=$smarty->fetch("$main_file.tpl"); +} $smarty->assign( array(MAIN=>$main, from=>$from, contact_section=>1, )); - -$smarty->assign("debug",$PHP_SELF." -- ".basename($PHP_SELF)." -- $section --". - $url[0] . "from: $from"); - - $smarty->display("index.tpl"); ?>