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 |
|
include("inc/sap_org_jed.inc"); |
10 |
|
|
11 |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
12 |
$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"); |
13 |
$sth->execute(); |
$korow=pg_fetch_array($result,0); |
|
$korow=$sth->fetchrow_hash(); |
|
14 |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
15 |
$prava=$korow[prava]; |
$prava=$korow[prava]; |
16 |
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>"; |
38 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
39 |
} elseif (isset($id) && $what!="auth") { |
} elseif (isset($id) && $what!="auth") { |
40 |
|
|
41 |
$sth = $dbh->prepare(" |
|
42 |
|
$result = pg_Exec ($conn, " |
43 |
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, |
|
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, |
45 |
umrezavanje,shell |
umrezavanje,shell |
46 |
from osobe,lokacije,org_jed,org_pod_jed |
from osobe |
47 |
where osobe.id=$id |
where osobe.id=$id |
48 |
and lokacija_id=lokacije.id and org_jed_id=org_jed.id |
and lokacija_id=lokacije.id |
49 |
and org_pod_jed_id=org_pod_jed.pod_id |
order by lokacije.naziv |
|
order by lokacije.naziv,org_jed.naziv |
|
50 |
"); |
"); |
51 |
|
|
52 |
$sth->execute(); |
if (pg_numrows($result) > 0) { |
53 |
|
$row=pg_fetch_array($result,0); |
|
if ($row=$sth->fetchrow_hash()) { |
|
54 |
|
|
55 |
print " |
print " |
56 |
<h1>Podaci o osobi</h1> |
<h1>Podaci o osobi</h1> |
60 |
<td>$row[ime] $row[prezime]</td> |
<td>$row[ime] $row[prezime]</td> |
61 |
<td><small>Tel:</small> $row[tel]</td></tr> |
<td><small>Tel:</small> $row[tel]</td></tr> |
62 |
<tr><td><small>Org. jedinica:</small></td> |
<tr><td><small>Org. jedinica:</small></td> |
63 |
<td>$row[orgjed]</td> |
<td rowspan=2>".sap_org_jed($row[sifra])." </td> |
64 |
<td><small>Šifra radnika:</small> $row[sifra]</td></tr> |
<td><small>Šifra radnika:</small> $row[sifra]</td></tr> |
65 |
<tr><td><small>Podjedinica:</small></td> |
<tr><td></td> |
|
<td>$row[orgpodjed]</td> |
|
66 |
<td><small>Lokacija računala:</small></td></tr> |
<td><small>Lokacija računala:</small></td></tr> |
67 |
<tr><td><small>Lokacija:</small></td> |
<tr><td><small>Lokacija:</small></td> |
68 |
<td>$row[lok]</td> |
<td>$row[lok]</td> |
81 |
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>"; |
82 |
} |
} |
83 |
|
|
84 |
|
// update nove lozinke i upis statusa |
85 |
|
if (($prava & $pr_lozinke) && $update_newpasswd) { |
86 |
|
$result = pg_Exec ($conn, "select login,passwd from racuni where id=$racuni_id"); |
87 |
|
$row=pg_fetch_array($result,0); |
88 |
|
|
89 |
|
include("inc/poppassd.inc"); |
90 |
|
$tmp=poppassd($row[login],$row[passwd],$newpasswd); |
91 |
|
|
92 |
|
if ($tmp[0]) { |
93 |
|
|
94 |
|
$sql="update racuni set passwd='$newpasswd' where racuni.id=$racuni_id"; |
95 |
|
pg_Exec ($conn, "$sql"); |
96 |
|
$sql="insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($id,$kontakt_osoba_id,'now'::datetime,7)"; |
97 |
|
$result = pg_Exec ($conn, $sql); |
98 |
|
$promjena_lozinke_result="Lozinka upisana! ".$tmp[1]; |
99 |
|
} else { |
100 |
|
$promjena_lozinke_result="<b>Greška</b>: ".$tmp[1]; |
101 |
|
} |
102 |
|
} |
103 |
|
|
104 |
// kreiraj statuse, zapamti da li je instaliran |
// kreiraj statuse, zapamti da li je instaliran |
105 |
|
|
106 |
$instaliran=0; |
$instaliran=0; |
107 |
|
|
108 |
$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 |
109 |
from status,kontakt_osobe,status_tip |
from status,kontakt_osobe,status_tip |
110 |
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 |
111 |
and osoba_id=$id order by datum"); |
and status.osoba_id=$id order by datum"); |
|
$sth->execute(); |
|
112 |
|
|
113 |
$statusi=""; |
$statusi=""; |
114 |
|
|
115 |
$nr=0; |
$nr = pg_numrows($result); |
116 |
while($row=$sth->fetchrow_hash()) { |
if ($nr > 0) { |
117 |
if ($row[st] != 2) { |
for ($i=0; $i<$nr; $i++) { |
118 |
$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); |
119 |
} else { |
if ($row[st] != 2) { |
120 |
$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>"; |
121 |
|
} else { |
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>"; |
123 |
|
} |
124 |
|
if ($row[st] == 6) { $instaliran = 1; }; |
125 |
} |
} |
126 |
if ($row[st] == 6) { $instaliran = 1; }; |
} else { |
|
$nr++; |
|
|
} |
|
|
|
|
|
if ($nr == 0) { |
|
127 |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
128 |
} |
} |
129 |
|
|
130 |
|
$server=3; |
131 |
|
$result = pg_Exec ($conn, "select racuni.login as login, |
132 |
|
racuni.passwd as passwd,e_mail.alias as email, |
133 |
|
racuni.id as racuni_id |
134 |
|
where racuni.osoba_id=$id and e_mail.osoba_id=$id |
135 |
|
and racuni.server_id=$server"); |
136 |
|
|
137 |
$sth = $dbh->prepare("select racuni.login as login, |
if (pg_numrows($result) > 0) { |
138 |
racuni.passwd as passwd,e_mail.alias as email |
$row=pg_fetch_array($result,0); |
|
from racuni,e_mail |
|
|
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
|
|
$sth->execute(); |
|
|
|
|
|
if ($row=$sth->fetchrow_hash()) { |
|
139 |
|
|
140 |
print " |
print " |
141 |
<h1>Podaci o korisničkom računu</h1> |
<h1>Podaci o korisničkom računu</h1> |
142 |
|
|
143 |
|
<form action=$PHP_SELF method=post> |
144 |
|
|
145 |
<table> |
<table> |
146 |
<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> |
147 |
"; |
"; |
148 |
if ($prava & $pr_instalacija) { |
if ($prava & $pr_instalacija || $prava & $pr_lozinke) { |
149 |
print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>"; |
print "<tr><td>Lozinka:</td><td><tt>".htmlspecialchars($row[passwd])."</tt>"; |
150 |
|
$passwd_ok="?"; |
151 |
|
if ($check_pop) { |
152 |
|
$pop3 = new POP3(); |
153 |
|
$pop3->connect("intranet.pliva.hr"); |
154 |
|
if ($pop3->checklogin($row[login],$row[passwd])) { |
155 |
|
$passwd_ok="t"; |
156 |
|
} else { |
157 |
|
$passwd_ok="f"; |
158 |
|
} |
159 |
|
$pop3->quit(); |
160 |
|
print show_bool($passwd_ok); |
161 |
|
} else { |
162 |
|
print "<input type=hidden name=id value=$id> |
163 |
|
<input type=submit name=check_pop value=\"Provjeri\"> |
164 |
|
"; |
165 |
|
} |
166 |
|
if ($prava & $pr_lozinke) { |
167 |
|
if ($input_newpasswd) { |
168 |
|
print "<input type=hidden name=id value=$id> |
169 |
|
<input type=text name=newpasswd value=\"$row[passwd]\" size=8> |
170 |
|
<input type=hidden name=racuni_id value=\"$row[racuni_id]\"> |
171 |
|
<input type=submit name=update_newpasswd value=\"Promjeni\">"; |
172 |
|
|
173 |
|
} elseif ($update_newpasswd) { |
174 |
|
print $promjena_lozinke_result; |
175 |
|
} else { |
176 |
|
print "<input type=hidden name=id value=$id> |
177 |
|
<input type=submit name=input_newpasswd value=\"Promjeni\">"; |
178 |
|
} |
179 |
|
}// prava=pr_lozinke |
180 |
|
print "</td></tr>"; |
181 |
} else { |
} else { |
182 |
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>"; |
183 |
} |
} |
192 |
|
|
193 |
|
|
194 |
print " |
print " |
195 |
|
</form> |
196 |
|
|
197 |
<h1>Podaci o statusima korisničkog računa</h1> |
<h1>Podaci o statusima korisničkog računa</h1> |
198 |
|
|
199 |
<form action=oznaci.php> |
<form action=oznaci.php> |
221 |
} |
} |
222 |
|
|
223 |
$statusi.="<td><select name=status_tip_id>"; |
$statusi.="<td><select name=status_tip_id>"; |
224 |
|
$min_status=5; |
225 |
|
if ($prava==$pr_admin) $min_status=3; |
226 |
|
|
227 |
$sth = $dbh->prepare("select id,opis |
$result = pg_Exec ($conn, "select id,opis |
228 |
from status_tip |
from status_tip |
229 |
where id >= 5 |
where id >= $min_status |
230 |
"); |
"); |
|
$sth->execute(); |
|
231 |
|
|
232 |
$num_prava=0; |
$num_prava=0; |
233 |
|
|
234 |
while ($row=$sth->fetchrow_hash()) { |
for ($i=0; $i<pg_numrows($result); $i++) { |
235 |
|
$row=pg_fetch_array($result,$i); |
236 |
if ($prava & pow(2,$row[id])) { |
if ($prava & pow(2,$row[id])) { |
237 |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
238 |
$num_prava++; |
$num_prava++; |
255 |
<hr> |
<hr> |
256 |
"; |
"; |
257 |
|
|
258 |
} else { // nema rezultata |
} else { // pg_numrows($result) > 0 |
259 |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
260 |
} |
} // pg_numrows($result) > 0 |
261 |
|
|
262 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
263 |
|
|