/[health_html]/inc/pgSalji.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /inc/pgSalji.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Oct 30 16:11:28 2001 UTC (22 years, 5 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Added the "pošalji e-mailom" feature. Added the ability to register on "Kalendar ovulacije" for e-mail notifications. Other fixes/improvements.

1 <?php
2 include("inc/conn.php");
3 $tpl->assign("ime", MyEscape($ime));
4 $tpl->assign("email1", MyEscape($email1));
5 $tpl->assign("email2", MyEscape($email2));
6 $tpl->assign("komentar", MyEscape($komentar));
7 $sql = "SELECT title FROM news WHERE (news_id = $id)";
8 $sth = $dbh->prepare($sql);
9 if (!$sth) error("Cannot prepare query: \"$sql\"");
10 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
11 $title = $sth->fetchrow_array();
12 $sth->finish();
13 if ($title) $title = array_shift($title);
14 if ($posalji) {
15 $error = 0;
16 if (!$email1) $error |= 1;
17 if ($email1 && !ereg('^[^\@]+\@[^\.]+\.[^\.]+.*$', $email1)) $error |= 2;
18 if (!$email2) $error |= 4;
19 if ($email2 && !ereg('^[^\@]+\@[^\.]+\.[^\.]+.*$', $email2)) $error |= 8;
20 $tpl->assign("error", $error);
21 if (!$error) {
22 include_once("inc/newsShow.php");
23 $art = array_shift(newsLoad($id));
24 $title2 = ($art["title"] ? strip_tags($art["title"]) : "");
25 $msg = "\n".($art["title"]?MyUpper($title2)."\n".str_repeat("=", strlen($title2))."\n\n":"").
26 ($art["lead"]?wordwrap(strip_tags($art["lead"]), 75, "\n")."\n":"");
27 for ($i = 0; $i < count($art["text"]); $i++) {
28 $txt = $art["text"][$i];
29 if (!$txt["title"] && !$txt["text"]) contine;
30 $msg .= "\n";
31 $title2 = ($txt["title"] ? strip_tags($txt["title"]) : "");
32 if ($txt["title"]) $msg .= $title2."\n".str_repeat("-", strlen($title2))."\n";
33 if ($txt["text"]) $msg .= wordwrap(strip_tags($txt["text"]), 75, "\n")."\n";
34 }
35 if ($komentar) $msg = "
36 $komentar
37
38 ------------------------------------------------
39
40 $msg";
41 $msg .= "
42 ------------------------------------------------
43 Ova poruka je poslana sa ".($isMed?"medicinskog":"zdravstvenog")." portala PLIVA".($isMed?"med.net":"zdravlje.hr")." (http://www.pliva".($isMed?"med.net":"zdravlje.hr")."/)
44 ";
45 if ($ime) $email1 = "$ime <$email1>";
46 mail($email2, "PLIVA".($isMed?"med.net":"zdravlje.hr").($title?" - ".$title:""), $msg, "From: $email1\nContent-Type: text/plain;charset=ISO-8859-2");
47 $tpl->assign("done", true);
48 }
49 }
50 $tpl->assign("title", $title ? $title : "");
51 $tpl->assign("ID", $id);
52 $dbh->disconnect();
53 ?>

  ViewVC Help
Powered by ViewVC 1.1.26