1 |
<?php |
2 |
require("Smarty.class.php"); |
3 |
require("conn.inc"); |
4 |
|
5 |
$smarty = new Smarty; |
6 |
|
7 |
$smarty->assign( array ( Title=>"Pliva d.d." ) ); |
8 |
|
9 |
$section=str_replace(".php","",basename($PHP_SELF)); |
10 |
$smarty->assign("section",$section); |
11 |
|
12 |
$main_file=$section; |
13 |
|
14 |
$title="CONTACT US"; |
15 |
$lpic="cont"; $lext=".jpg"; |
16 |
$mpic="contactus.gif"; |
17 |
|
18 |
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); |
19 |
|
20 |
if (! isset($from) || $from == "") { |
21 |
$from=str_replace(".php","",basename($HTTP_REFERER)); |
22 |
if (strstr($from,"?")) $from=substr($from,0,strpos($from,"?")); |
23 |
if ($from == $HTTP_HOST || $from=="www.pliva.hr") $from="index"; |
24 |
} |
25 |
|
26 |
$email="webmaster@pliva.hr"; // default |
27 |
|
28 |
$sth = $dbh->prepare("select email from emails where referer='$from' limit 1"); |
29 |
$sth->execute(); |
30 |
if ($row=$sth->fetchrow_hash()) { |
31 |
$email=$row[email]; |
32 |
} else { |
33 |
$sth = $dbh->prepare("select email from emails,menu where menu.section=referer and url like '$from%'"); |
34 |
$sth->execute(); |
35 |
if ($row=$sth->fetchrow_hash()) { |
36 |
$email=$row[email]; |
37 |
} |
38 |
} |
39 |
|
40 |
$email=str_replace("\n","",$email); |
41 |
$email=str_replace(" ","",$email); |
42 |
$email_val=explode(",",$email); |
43 |
|
44 |
$sth = $dbh->prepare("select iso,name from countries order by name"); |
45 |
$sth->execute(); |
46 |
while ($row=$sth->fetchrow_hash()) { |
47 |
$countries[]=$row; |
48 |
} |
49 |
$smarty->assign(array(countries=>$countries, |
50 |
email_val=>$email_val, |
51 |
)); |
52 |
|
53 |
include("common.inc"); |
54 |
|
55 |
if (isset($mailto) && check_required()) { |
56 |
$main="Your comment is sent to $mailto. Thank you."; |
57 |
include("quoted-printable.inc"); |
58 |
iso_mail("$fullname ($country) <$mailfrom>",$mailto,$subject,$comment); |
59 |
# $main.="<pre>$mailto $fullname $mailfrom $country $subject $comment</pre>"; |
60 |
} else { |
61 |
$main=$smarty->fetch("$main_file.tpl"); |
62 |
} |
63 |
|
64 |
$smarty->assign( array(MAIN=>$main, from=>$from, |
65 |
contact_section=>1, |
66 |
)); |
67 |
|
68 |
$smarty->display("index.tpl"); |
69 |
?> |