1 |
<?php |
2 |
|
3 |
if (! isset($from) || $from == "") { |
4 |
$from=str_replace(".php","",basename($HTTP_REFERER)); |
5 |
if (strstr($from,"?")) $from=substr($from,0,strpos($from,"?")); |
6 |
if ($from == $HTTP_HOST || $from=="www.pliva.si") $from="index"; |
7 |
} |
8 |
|
9 |
$email="info@pliva.si"; // default |
10 |
|
11 |
$sth = $dbh->prepare("select email from emails where referer='$from' limit 1"); |
12 |
$sth->execute(); |
13 |
if ($row=$sth->fetchrow_hash()) { |
14 |
$email=$row[email]; |
15 |
} else { |
16 |
$sth = $dbh->prepare("select email from emails,menu where menu.section=referer and url like '$from%'"); |
17 |
$sth->execute(); |
18 |
if ($row=$sth->fetchrow_hash()) { |
19 |
$email=$row[email]; |
20 |
} |
21 |
} |
22 |
|
23 |
$email=str_replace("\n","",$email); |
24 |
$email=str_replace(" ","",$email); |
25 |
$email_val=explode(",",$email); |
26 |
|
27 |
$countries[]=array( |
28 |
"iso" => "SI", |
29 |
"name" => "Slovenia" |
30 |
); |
31 |
|
32 |
$sth = $dbh->prepare("select iso,name from countries where upper(iso)<>'SI' order by name"); |
33 |
$sth->execute(); |
34 |
while ($row=$sth->fetchrow_hash()) { |
35 |
$countries[]=$row; |
36 |
} |
37 |
$smarty->assign(array(countries=>$countries, |
38 |
email_val=>$email_val, |
39 |
)); |
40 |
|
41 |
if (isset($mailto) && check_required()) { |
42 |
$main="Sporoèilo je bilo poslano na naslov $mailto. Hvala."; |
43 |
include("quoted-printable.inc"); |
44 |
iso_mail("$fullname ($country) <$mailfrom>",$mailto,$subject,$comment); |
45 |
# $main.="<pre>$mailto $fullname $mailfrom $country $subject $comment</pre>"; |
46 |
} else { |
47 |
$main=$smarty->fetch("$main_file.tpl"); |
48 |
} |
49 |
|
50 |
$smarty->assign( array(MAIN=>$main, from=>$from, |
51 |
contact_section=>1, |
52 |
)); |
53 |
|
54 |
?> |