--- contact.php 2001/03/05 15:22:27 1.6 +++ contact.php 2001/03/18 23:36:26 1.10 @@ -17,14 +17,23 @@ $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,"?")); +} + +$email="webmaster@pliva.hr"; // default $sth = $dbh->prepare("select email from emails where referer='$from' limit 1"); $sth->execute(); -$email="webmaster@pliva.hr"; if ($row=$sth->fetchrow_hash()) { $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]; + } } $email=str_replace("\n","",$email); @@ -42,23 +51,18 @@ 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, contact_section=>1, )); - -$smarty->assign("debug",$PHP_SELF." -- ".basename($PHP_SELF)." -- $section --". - $url[0] . "from: $from"); - - $smarty->display("index.tpl"); ?>