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 |
|
$sql="update racuni set passwd='$newpasswd' where racuni.id=$racuni_id"; |
89 |
|
pg_Exec ($conn, "$sql"); |
90 |
|
$sql="insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($id,$kontakt_osoba_id,'now'::datetime,7)"; |
91 |
|
$result = pg_Exec ($conn, $sql); |
92 |
|
$promjena_lozinke_result="<b>Nova lozinka upisana u bazu! Treba je ručno promjeniti na serveru!</b>"; |
93 |
|
} |
94 |
|
|
95 |
// kreiraj statuse, zapamti da li je instaliran |
// kreiraj statuse, zapamti da li je instaliran |
96 |
|
|
97 |
$instaliran=0; |
$instaliran=0; |
98 |
|
|
99 |
$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 |
100 |
from status,kontakt_osobe,status_tip |
from status,kontakt_osobe,status_tip |
101 |
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 |
102 |
and osoba_id=$id order by datum"); |
and status.osoba_id=$id order by datum"); |
|
$sth->execute(); |
|
103 |
|
|
104 |
$statusi=""; |
$statusi=""; |
105 |
|
|
106 |
$nr=0; |
$nr = pg_numrows($result); |
107 |
while($row=$sth->fetchrow_hash()) { |
if ($nr > 0) { |
108 |
if ($row[st] != 2) { |
for ($i=0; $i<$nr; $i++) { |
109 |
$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); |
110 |
} else { |
if ($row[st] != 2) { |
111 |
$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>"; |
112 |
|
} else { |
113 |
|
$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>"; |
114 |
|
} |
115 |
|
if ($row[st] == 6) { $instaliran = 1; }; |
116 |
} |
} |
117 |
if ($row[st] == 6) { $instaliran = 1; }; |
} else { |
|
$nr++; |
|
|
} |
|
|
|
|
|
if ($nr == 0) { |
|
118 |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
119 |
} |
} |
120 |
|
|
121 |
|
|
122 |
$sth = $dbh->prepare("select racuni.login as login, |
$result = pg_Exec ($conn, "select racuni.login as login, |
123 |
racuni.passwd as passwd,e_mail.alias as email |
racuni.passwd as passwd,e_mail.alias as email, |
124 |
|
racuni.id as racuni_id |
125 |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
|
$sth->execute(); |
|
126 |
|
|
127 |
if ($row=$sth->fetchrow_hash()) { |
if (pg_numrows($result) > 0) { |
128 |
|
$row=pg_fetch_array($result,0); |
129 |
|
|
130 |
print " |
print " |
131 |
<h1>Podaci o korisničkom računu</h1> |
<h1>Podaci o korisničkom računu</h1> |
132 |
|
|
133 |
|
<form action=$PHP_SELF method=post> |
134 |
|
|
135 |
<table> |
<table> |
136 |
<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> |
137 |
"; |
"; |
138 |
if ($prava & $pr_instalacija) { |
if ($prava & $pr_instalacija || $prava & $pr_lozinke) { |
139 |
print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>"; |
print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt>"; |
140 |
|
$passwd_ok="?"; |
141 |
|
if ($check_pop) { |
142 |
|
$pop3 = new POP3(); |
143 |
|
$pop3->connect("intranet.pliva.hr"); |
144 |
|
if ($pop3->checklogin($row[login],$row[passwd])) { |
145 |
|
$passwd_ok="t"; |
146 |
|
} else { |
147 |
|
$passwd_ok="f"; |
148 |
|
} |
149 |
|
$pop3->quit(); |
150 |
|
print show_bool($passwd_ok); |
151 |
|
} else { |
152 |
|
print "<input type=hidden name=id value=$id> |
153 |
|
<input type=submit name=check_pop value=\"Provjeri\"> |
154 |
|
"; |
155 |
|
} |
156 |
|
if ($prava & $pr_lozinke) { |
157 |
|
if ($input_newpasswd) { |
158 |
|
print "<input type=hidden name=id value=$id> |
159 |
|
<input type=text name=newpasswd value=\"$row[passwd]\" size=8> |
160 |
|
<input type=hidden name=racuni_id value=\"$row[racuni_id]\"> |
161 |
|
<input type=submit name=update_newpasswd value=\"Promjeni\">"; |
162 |
|
|
163 |
|
} elseif ($update_newpasswd) { |
164 |
|
print $promjena_lozinke_result; |
165 |
|
} else { |
166 |
|
print "<input type=hidden name=id value=$id> |
167 |
|
<input type=submit name=input_newpasswd value=\"Promjeni\">"; |
168 |
|
} |
169 |
|
}// prava=pr_lozinke |
170 |
|
print "</td></tr>"; |
171 |
} else { |
} else { |
172 |
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>"; |
173 |
} |
} |
182 |
|
|
183 |
|
|
184 |
print " |
print " |
185 |
|
</form> |
186 |
|
|
187 |
<h1>Podaci o statusima korisničkog računa</h1> |
<h1>Podaci o statusima korisničkog računa</h1> |
188 |
|
|
189 |
<form action=oznaci.php> |
<form action=oznaci.php> |
211 |
} |
} |
212 |
|
|
213 |
$statusi.="<td><select name=status_tip_id>"; |
$statusi.="<td><select name=status_tip_id>"; |
214 |
|
$min_status=5; |
215 |
|
if ($prava==$pr_admin) $min_status=3; |
216 |
|
|
217 |
$sth = $dbh->prepare("select id,opis |
$result = pg_Exec ($conn, "select id,opis |
218 |
from status_tip |
from status_tip |
219 |
where id >= 5 |
where id >= $min_status |
220 |
"); |
"); |
|
$sth->execute(); |
|
221 |
|
|
222 |
$num_prava=0; |
$num_prava=0; |
223 |
|
|
224 |
while ($row=$sth->fetchrow_hash()) { |
for ($i=0; $i<pg_numrows($result); $i++) { |
225 |
|
$row=pg_fetch_array($result,$i); |
226 |
if ($prava & pow(2,$row[id])) { |
if ($prava & pow(2,$row[id])) { |
227 |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
228 |
$num_prava++; |
$num_prava++; |
245 |
<hr> |
<hr> |
246 |
"; |
"; |
247 |
|
|
248 |
} else { // nema rezultata |
} else { // pg_numrows($result) > 0 |
249 |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
250 |
} |
} // pg_numrows($result) > 0 |
251 |
|
|
252 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
253 |
|
|