1 |
<? |
<? |
2 |
|
|
3 |
global $smarty,$dbh,$auth_required; |
global $smarty,$dbh,$user_authed; |
4 |
|
|
5 |
// fetch menu |
// fetch menu |
6 |
|
|
27 |
|
|
28 |
$sql_where=" and substr(type,3,1)<>'x'" ; // don't show locked records |
$sql_where=" and substr(type,3,1)<>'x'" ; // don't show locked records |
29 |
|
|
30 |
|
|
31 |
// auth... based on m |
// auth... based on m |
32 |
|
|
33 |
|
$cookie_data=md5(strftime("%w%Y").$PHP_AUTH_USER.$PHP_AUTH_PW); |
34 |
|
|
35 |
if ($m == "za_zdravnike") { |
if ($m == "za_zdravnike") { |
|
Header("X-auth: needed"); |
|
|
print "<!-- auth needed -->"; |
|
36 |
|
|
37 |
$sql_where=""; |
|
38 |
|
if ($cookie_data != $pliva_si_user) { |
39 |
|
|
40 |
|
$sth = $dbh->prepare("select login as user,geslo as pw from people where login = '$PHP_AUTH_USER'"); |
41 |
|
$sth->execute(); |
42 |
|
if (! $row=$sth->fetchrow_hash() || $PHP_AUTH_PW != $row[pw]) { |
43 |
|
header("WWW-authenticate: basic realm=\"$HTTP_HOST\"") ; |
44 |
|
header("HTTP/1.0 401 Unauthorized") ; |
45 |
|
print "<html>Unauthorized</html>"; |
46 |
|
exit; |
47 |
|
} else { |
48 |
|
setcookie("pliva_si_user",$cookie_data); |
49 |
|
} |
50 |
|
} |
51 |
|
|
52 |
|
$user_authed++; |
53 |
|
|
54 |
|
$sql_where=""; // don't limit output to authed users |
55 |
|
} else { |
56 |
|
if ($cookie_data == $pliva_si_user) $user_authed++; |
57 |
} |
} |
58 |
|
$smarty->assign("user_authed",$user_authed); |
59 |
|
|
60 |
|
|
61 |
// fetch news |
// fetch news |
62 |
|
|
74 |
} |
} |
75 |
$smarty->assign("events",$events); |
$smarty->assign("events",$events); |
76 |
|
|
77 |
|
$smarty->assign("self",$PHP_SELF); |
78 |
|
|
79 |
#include("debug.inc"); |
#include("debug.inc"); |
80 |
|
|
81 |
function check_required() { |
function check_required() { |
89 |
case 'email': |
case 'email': |
90 |
if (!strstr($GLOBALS[$i],'@')) $ok=0; |
if (!strstr($GLOBALS[$i],'@')) $ok=0; |
91 |
} |
} |
92 |
// print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok -- "; |
# print "$i: $GLOBALS[$i] type: $inputs_required_type[$i] $ok --<br>\n "; |
93 |
|
|
94 |
} |
} |
95 |
} else { |
} else { |