4 |
include("inc/prava.inc"); |
include("inc/prava.inc"); |
5 |
include("inc/print_bool2.inc"); |
include("inc/print_bool2.inc"); |
6 |
include("inc/bgcolor.inc"); |
include("inc/bgcolor.inc"); |
7 |
|
include("inc/show_bool.inc"); |
8 |
|
include("inc/auth_pop3.inc"); |
9 |
|
|
10 |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
11 |
$sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
$result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
12 |
$sth->execute(); |
$korow=pg_fetch_array($result,0); |
|
$korow=$sth->fetchrow_hash(); |
|
13 |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
14 |
$prava=$korow[prava]; |
$prava=$korow[prava]; |
15 |
print "<small>Trenutno ste prijavljeni kao $korow[ime] $korow[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>"; |
print "<small>Trenutno ste prijavljeni kao $korow[ime] $korow[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>"; |
37 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
38 |
} elseif (isset($id) && $what!="auth") { |
} elseif (isset($id) && $what!="auth") { |
39 |
|
|
40 |
$sth = $dbh->prepare(" |
|
41 |
|
$result = pg_Exec ($conn, " |
42 |
select osobe.id as id,ime,prezime,tel,lokacije.naziv as lok,sifra, |
select osobe.id as id,ime,prezime,tel,lokacije.naziv as lok,sifra, |
43 |
org_jed.naziv as orgjed,org_pod_jed.pod_naziv as orgpodjed, |
org_jed.naziv as orgjed,org_pod_jed.pod_naziv as orgpodjed, |
44 |
lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje, |
lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje, |
50 |
order by lokacije.naziv,org_jed.naziv |
order by lokacije.naziv,org_jed.naziv |
51 |
"); |
"); |
52 |
|
|
53 |
$sth->execute(); |
if (pg_numrows($result) > 0) { |
54 |
|
$row=pg_fetch_array($result,0); |
|
if ($row=$sth->fetchrow_hash()) { |
|
55 |
|
|
56 |
print " |
print " |
57 |
<h1>Podaci o osobi</h1> |
<h1>Podaci o osobi</h1> |
83 |
print "<small><a href=\"osoba.php?what=select-osoba&id=$id\">[promjeni podatke o osobi]</a></small>"; |
print "<small><a href=\"osoba.php?what=select-osoba&id=$id\">[promjeni podatke o osobi]</a></small>"; |
84 |
} |
} |
85 |
|
|
86 |
|
// update nove lozinke i upis statusa |
87 |
|
if (($prava & $pr_lozinke) && $update_newpasswd) { |
88 |
|
$result = pg_Exec ($conn, "select login,passwd from racuni where id=$racuni_id"); |
89 |
|
$row=pg_fetch_array($result,0); |
90 |
|
|
91 |
|
include("inc/poppassd.inc"); |
92 |
|
$tmp=poppassd($row[login],$row[passwd],$newpasswd); |
93 |
|
|
94 |
|
if ($tmp[0]) { |
95 |
|
|
96 |
|
$sql="update racuni set passwd='$newpasswd' where racuni.id=$racuni_id"; |
97 |
|
pg_Exec ($conn, "$sql"); |
98 |
|
$sql="insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($id,$kontakt_osoba_id,'now'::datetime,7)"; |
99 |
|
$result = pg_Exec ($conn, $sql); |
100 |
|
$promjena_lozinke_result="Lozinka upisana! ".$tmp[1]; |
101 |
|
} else { |
102 |
|
$promjena_lozinke_result="<b>Greška</b>: ".$tmp[1]; |
103 |
|
} |
104 |
|
} |
105 |
|
|
106 |
// kreiraj statuse, zapamti da li je instaliran |
// kreiraj statuse, zapamti da li je instaliran |
107 |
|
|
108 |
$instaliran=0; |
$instaliran=0; |
109 |
|
|
110 |
$sth = $dbh->prepare("select status.id as status_id,datum,opis,ime,prezime,status_tip_id as st |
$result = pg_Exec ($conn, "select status.id as status_id,datum,opis,ime,prezime,status_tip_id as st |
111 |
from status,kontakt_osobe,status_tip |
from status,kontakt_osobe,status_tip |
112 |
where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id |
where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id |
113 |
and osoba_id=$id order by datum"); |
and status.osoba_id=$id order by datum"); |
|
$sth->execute(); |
|
114 |
|
|
115 |
$statusi=""; |
$statusi=""; |
116 |
|
|
117 |
$nr=0; |
$nr = pg_numrows($result); |
118 |
while($row=$sth->fetchrow_hash()) { |
if ($nr > 0) { |
119 |
if ($row[st] != 2) { |
for ($i=0; $i<$nr; $i++) { |
120 |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>"; |
$row=pg_fetch_array($result,$i); |
121 |
} else { |
if ($row[st] != 2) { |
122 |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td><a href=\"promjene.php?osoba_id=$id&status_id=$row[status_id]\">$row[opis]</a></td><td>$row[ime] $row[prezime]</td></tr>"; |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>"; |
123 |
|
} else { |
124 |
|
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td><a href=\"promjene.php?osoba_id=$id&status_id=$row[status_id]\">$row[opis]</a></td><td>$row[ime] $row[prezime]</td></tr>"; |
125 |
|
} |
126 |
|
if ($row[st] == 6) { $instaliran = 1; }; |
127 |
} |
} |
128 |
if ($row[st] == 6) { $instaliran = 1; }; |
} else { |
|
$nr++; |
|
|
} |
|
|
|
|
|
if ($nr == 0) { |
|
129 |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
130 |
} |
} |
131 |
|
|
132 |
|
|
133 |
$sth = $dbh->prepare("select racuni.login as login, |
$result = pg_Exec ($conn, "select racuni.login as login, |
134 |
racuni.passwd as passwd,e_mail.alias as email |
racuni.passwd as passwd,e_mail.alias as email, |
135 |
|
racuni.id as racuni_id |
136 |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
|
$sth->execute(); |
|
137 |
|
|
138 |
if ($row=$sth->fetchrow_hash()) { |
if (pg_numrows($result) > 0) { |
139 |
|
$row=pg_fetch_array($result,0); |
140 |
|
|
141 |
print " |
print " |
142 |
<h1>Podaci o korisničkom računu</h1> |
<h1>Podaci o korisničkom računu</h1> |
143 |
|
|
144 |
|
<form action=$PHP_SELF method=post> |
145 |
|
|
146 |
<table> |
<table> |
147 |
<tr><td>Korisnička oznaka:</td><td><tt>$row[login]</tt></td></tr> |
<tr><td>Korisnička oznaka:</td><td><tt>$row[login]</tt></td></tr> |
148 |
"; |
"; |
149 |
if ($prava & $pr_instalacija) { |
if ($prava & $pr_instalacija || $prava & $pr_lozinke) { |
150 |
print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>"; |
print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt>"; |
151 |
|
$passwd_ok="?"; |
152 |
|
if ($check_pop) { |
153 |
|
$pop3 = new POP3(); |
154 |
|
$pop3->connect("intranet.pliva.hr"); |
155 |
|
if ($pop3->checklogin($row[login],$row[passwd])) { |
156 |
|
$passwd_ok="t"; |
157 |
|
} else { |
158 |
|
$passwd_ok="f"; |
159 |
|
} |
160 |
|
$pop3->quit(); |
161 |
|
print show_bool($passwd_ok); |
162 |
|
} else { |
163 |
|
print "<input type=hidden name=id value=$id> |
164 |
|
<input type=submit name=check_pop value=\"Provjeri\"> |
165 |
|
"; |
166 |
|
} |
167 |
|
if ($prava & $pr_lozinke) { |
168 |
|
if ($input_newpasswd) { |
169 |
|
print "<input type=hidden name=id value=$id> |
170 |
|
<input type=text name=newpasswd value=\"$row[passwd]\" size=8> |
171 |
|
<input type=hidden name=racuni_id value=\"$row[racuni_id]\"> |
172 |
|
<input type=submit name=update_newpasswd value=\"Promjeni\">"; |
173 |
|
|
174 |
|
} elseif ($update_newpasswd) { |
175 |
|
print $promjena_lozinke_result; |
176 |
|
} else { |
177 |
|
print "<input type=hidden name=id value=$id> |
178 |
|
<input type=submit name=input_newpasswd value=\"Promjeni\">"; |
179 |
|
} |
180 |
|
}// prava=pr_lozinke |
181 |
|
print "</td></tr>"; |
182 |
} else { |
} else { |
183 |
print "<tr><td colspan=2><i>Nemate ovlaštenja vidjeti lozinku ovog korisnika!</i></td></tr>"; |
print "<tr><td colspan=2><i>Nemate ovlaštenja vidjeti lozinku ovog korisnika!</i></td></tr>"; |
184 |
} |
} |
193 |
|
|
194 |
|
|
195 |
print " |
print " |
196 |
|
</form> |
197 |
|
|
198 |
<h1>Podaci o statusima korisničkog računa</h1> |
<h1>Podaci o statusima korisničkog računa</h1> |
199 |
|
|
200 |
<form action=oznaci.php> |
<form action=oznaci.php> |
222 |
} |
} |
223 |
|
|
224 |
$statusi.="<td><select name=status_tip_id>"; |
$statusi.="<td><select name=status_tip_id>"; |
225 |
|
$min_status=5; |
226 |
|
if ($prava==$pr_admin) $min_status=3; |
227 |
|
|
228 |
$sth = $dbh->prepare("select id,opis |
$result = pg_Exec ($conn, "select id,opis |
229 |
from status_tip |
from status_tip |
230 |
where id >= 5 |
where id >= $min_status |
231 |
"); |
"); |
|
$sth->execute(); |
|
232 |
|
|
233 |
$num_prava=0; |
$num_prava=0; |
234 |
|
|
235 |
while ($row=$sth->fetchrow_hash()) { |
for ($i=0; $i<pg_numrows($result); $i++) { |
236 |
|
$row=pg_fetch_array($result,$i); |
237 |
if ($prava & pow(2,$row[id])) { |
if ($prava & pow(2,$row[id])) { |
238 |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
239 |
$num_prava++; |
$num_prava++; |
256 |
<hr> |
<hr> |
257 |
"; |
"; |
258 |
|
|
259 |
} else { // nema rezultata |
} else { // pg_numrows($result) > 0 |
260 |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
261 |
} |
} // pg_numrows($result) > 0 |
262 |
|
|
263 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
264 |
|
|