2 |
|
|
3 |
include("inc/head.inc"); |
include("inc/head.inc"); |
4 |
include("inc/prava.inc"); |
include("inc/prava.inc"); |
5 |
include("inc/show_bool.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 |
$result = pg_Exec ($conn, "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 |
# 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>"; |
16 |
$curr_md5_passwd=base64_encode(mhash(MHASH_MD5,$korow[passwd])); |
$curr_md5_passwd=md5($korow[passwd]); |
17 |
if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) || |
if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) || |
18 |
(isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) { |
(isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) { |
19 |
include("inc/auth.inc"); |
include("inc/auth.inc"); |
23 |
print '<p><a href="index.php">Povratak na početnu stranicu</a>'; |
print '<p><a href="index.php">Povratak na početnu stranicu</a>'; |
24 |
} else { |
} else { |
25 |
session_register("md5_passwd"); |
session_register("md5_passwd"); |
26 |
$md5_passwd=base64_encode(mhash(MHASH_MD5,$korow[passwd])); |
$md5_passwd=md5($korow[passwd]); |
27 |
} |
} |
28 |
} |
} |
29 |
|
|
72 |
<tr><td><small>Objekt/soba/kat:</small></td> |
<tr><td><small>Objekt/soba/kat:</small></td> |
73 |
<td>$row[objekt] / $row[soba] / $row[kat]</td> |
<td>$row[objekt] / $row[soba] / $row[kat]</td> |
74 |
<td><small>Ž računala:</small> $row[z_rac]</td></tr> |
<td><small>Ž računala:</small> $row[z_rac]</td></tr> |
75 |
<tr><td>Shell: ".show_bool($row[shell])."</td> |
<tr><td>Shell: ".print_bool($row[shell])."</td> |
76 |
<td>Umrežavanje: ".show_bool($row[umrezavanje])."</td> |
<td>Umrežavanje: ".print_bool($row[umrezavanje])."</td> |
77 |
<td>Podešavanje: ".show_bool($row[podesavanje])."</td> |
<td>Podešavanje: ".print_bool($row[podesavanje])."</td> |
78 |
</table> |
</table> |
79 |
"; |
"; |
80 |
|
|
81 |
|
|
82 |
|
if ($prava & $pr_promjena) { |
83 |
|
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 |
$result = pg_Exec ($conn, "select 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"); |
114 |
|
|
115 |
$statusi=""; |
$statusi=""; |
116 |
|
|
117 |
$nr = pg_numrows($result); |
$nr = pg_numrows($result); |
118 |
if ($nr > 0) { |
if ($nr > 0) { |
119 |
for ($i=0;$i<$nr; $i++) { |
for ($i=0; $i<$nr; $i++) { |
120 |
$row=pg_fetch_array($result,$i); |
$row=pg_fetch_array($result,$i); |
121 |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>"; |
if ($row[st] != 2) { |
122 |
|
$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; }; |
if ($row[st] == 6) { $instaliran = 1; }; |
127 |
} |
} |
128 |
} else { |
} else { |
131 |
|
|
132 |
|
|
133 |
$result = pg_Exec ($conn, "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"); |
137 |
|
|
138 |
if (pg_numrows($result) > 0) { |
if (pg_numrows($result) > 0) { |
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> |
203 |
|
|
204 |
<table border=0> |
<table border=0> |
205 |
<tr><th>datum</th><th>status</th><th>status postavio/la</th></tr> |
<tr><th>datum</th><th>status</th><th>status postavio/la</th></tr> |
206 |
$statusi |
$statusi"; |
207 |
<tr><td align=right><b>Dodati status:</b></td> |
|
208 |
|
$statusi="<tr>"; |
209 |
|
|
210 |
|
if ($prava == $pr_admin) { |
211 |
|
$statusi.="<td><select name=date_offset> |
212 |
|
<option value=>danas</option> |
213 |
|
<option value=1>sutra</option>"; |
214 |
|
$dani=array("nedjelju","ponedjeljak","utorak","srijedu", |
215 |
|
"četvrtak","petak","subotu"); |
216 |
|
for ($d=2; $d<10; $d++) { |
217 |
|
$statusi.="<option value=$d>u ".$dani[(date("w")+$d) % 7].", ". date("d.m.Y",time()+$d*24*60*60)."</option>"; |
218 |
|
} |
219 |
|
$statusi.="</select></td>"; |
220 |
|
} else { |
221 |
|
$statusi.="<td align=right><b>Dodati status:</b></td>"; |
222 |
|
} |
223 |
|
|
224 |
<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 |
$result = pg_Exec ($conn, "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 |
"); |
"); |
232 |
|
|
233 |
|
$num_prava=0; |
234 |
|
|
235 |
for ($i=0; $i<pg_numrows($result); $i++) { |
for ($i=0; $i<pg_numrows($result); $i++) { |
236 |
$row=pg_fetch_array($result,$i); |
$row=pg_fetch_array($result,$i); |
237 |
print "<option value=$row[id]>$row[opis]</option>\n"; |
if ($prava & pow(2,$row[id])) { |
238 |
|
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
239 |
|
$num_prava++; |
240 |
|
} |
241 |
} |
} |
242 |
|
|
243 |
print "</select></td> |
$statusi.="</select></td> |
|
|
|
244 |
<td>$korow[ime] $korow[prezime]</td> |
<td>$korow[ime] $korow[prezime]</td> |
245 |
<td><input type=submit value=\"Dodaj\"></td></tr> |
<td><input type=submit value=\"Dodaj\"></td></tr>"; |
246 |
|
|
247 |
|
if ($num_prava>0) { |
248 |
|
print "$statusi"; |
249 |
|
} |
250 |
|
|
251 |
|
print " |
252 |
</table> |
</table> |
253 |
</form> |
</form> |
254 |
|
|
264 |
|
|
265 |
} // isset($id) |
} // isset($id) |
266 |
|
|
267 |
print '<p>Povratak na <a href="lista.php">listu zahtjeva</a> ili |
print "<p>Povratak na "; |
268 |
<a href="/">početnu stranicu</a>.'; |
if (isset($HTTP_REFERER)) { |
269 |
|
print "<a href=\"$HTTP_REFERER\">stranicu sa koje ste došli</a> ili "; |
270 |
|
} |
271 |
|
print "<a href=\"/\">početnu stranicu</a>."; |
272 |
|
|
273 |
|
|
274 |
include("inc/footer.inc"); |
include("inc/footer.inc"); |
275 |
|
|