--- contact.php 2001/03/12 12:53:16 1.8 +++ contact.php 2001/10/01 14:05:16 1.13 @@ -6,19 +6,16 @@ $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 (strstr($from,"?")) $from=substr($from,0,strpos($from,"?")); +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 @@ -27,7 +24,7 @@ if ($row=$sth->fetchrow_hash()) { $email=$row[email]; } else { - $sth = $dbh->prepare("select email from emails,menu where menu.section=referer and url='results.php?type=a'"); + $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]; @@ -49,13 +46,13 @@ include("common.inc"); -if (! isset($mailto)) { - $main=$smarty->fetch("$main_file.tpl"); -} else { +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,