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 |
|
|
8 |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
if (isset($kontakt_osoba_id) && $what!="relogin") { |
9 |
$result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
$sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
10 |
$korow=pg_fetch_array($result,0); |
$sth->execute(); |
11 |
|
$korow=$sth->fetchrow_hash(); |
12 |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
# print "--$korow[passwd] | $md5_passwd | $passwd "; |
13 |
$prava=$korow[prava]; |
$prava=$korow[prava]; |
14 |
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>"; |
15 |
$curr_md5_passwd=base64_encode(mhash(MHASH_MD5,$korow[passwd])); |
$curr_md5_passwd=md5($korow[passwd]); |
16 |
if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) || |
if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) || |
17 |
(isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) { |
(isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) { |
18 |
include("inc/auth.inc"); |
include("inc/auth.inc"); |
22 |
print '<p><a href="index.php">Povratak na početnu stranicu</a>'; |
print '<p><a href="index.php">Povratak na početnu stranicu</a>'; |
23 |
} else { |
} else { |
24 |
session_register("md5_passwd"); |
session_register("md5_passwd"); |
25 |
$md5_passwd=base64_encode(mhash(MHASH_MD5,$korow[passwd])); |
$md5_passwd=md5($korow[passwd]); |
26 |
} |
} |
27 |
} |
} |
28 |
|
|
36 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
37 |
} elseif (isset($id) && $what!="auth") { |
} elseif (isset($id) && $what!="auth") { |
38 |
|
|
39 |
|
$sth = $dbh->prepare(" |
|
$result = pg_Exec ($conn, " |
|
40 |
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, |
41 |
org_jed.naziv as orgjed,org_pod_jed.pod_naziv as orgpodjed, |
org_jed.naziv as orgjed,org_pod_jed.pod_naziv as orgpodjed, |
42 |
lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje, |
lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje, |
48 |
order by lokacije.naziv,org_jed.naziv |
order by lokacije.naziv,org_jed.naziv |
49 |
"); |
"); |
50 |
|
|
51 |
if (pg_numrows($result) > 0) { |
$sth->execute(); |
52 |
$row=pg_fetch_array($result,0); |
|
53 |
|
if ($row=$sth->fetchrow_hash()) { |
54 |
|
|
55 |
print " |
print " |
56 |
<h1>Podaci o osobi</h1> |
<h1>Podaci o osobi</h1> |
71 |
<tr><td><small>Objekt/soba/kat:</small></td> |
<tr><td><small>Objekt/soba/kat:</small></td> |
72 |
<td>$row[objekt] / $row[soba] / $row[kat]</td> |
<td>$row[objekt] / $row[soba] / $row[kat]</td> |
73 |
<td><small>Ž računala:</small> $row[z_rac]</td></tr> |
<td><small>Ž računala:</small> $row[z_rac]</td></tr> |
74 |
<tr><td>Shell: ".show_bool($row[shell])."</td> |
<tr><td>Shell: ".print_bool($row[shell])."</td> |
75 |
<td>Umrežavanje: ".show_bool($row[umrezavanje])."</td> |
<td>Umrežavanje: ".print_bool($row[umrezavanje])."</td> |
76 |
<td>Podešavanje: ".show_bool($row[podesavanje])."</td> |
<td>Podešavanje: ".print_bool($row[podesavanje])."</td> |
77 |
</table> |
</table> |
78 |
"; |
"; |
79 |
|
|
86 |
|
|
87 |
$instaliran=0; |
$instaliran=0; |
88 |
|
|
89 |
$result = pg_Exec ($conn, "select status.id as status_id,datum,opis,ime,prezime,status_tip_id as st |
$sth = $dbh->prepare("select status.id as status_id,datum,opis,ime,prezime,status_tip_id as st |
90 |
from status,kontakt_osobe,status_tip |
from status,kontakt_osobe,status_tip |
91 |
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 |
92 |
and osoba_id=$id order by datum"); |
and osoba_id=$id order by datum"); |
93 |
|
$sth->execute(); |
94 |
|
|
95 |
$statusi=""; |
$statusi=""; |
96 |
|
|
97 |
$nr = pg_numrows($result); |
$nr=0; |
98 |
if ($nr > 0) { |
while($row=$sth->fetchrow_hash()) { |
99 |
for ($i=0; $i<$nr; $i++) { |
if ($row[st] != 2) { |
100 |
$row=pg_fetch_array($result,$i); |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>"; |
101 |
if ($row[st] != 2) { |
} else { |
102 |
$statusi.="<tr ".bgcolor()."><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>"; |
$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>"; |
|
} else { |
|
|
$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>"; |
|
|
} |
|
|
if ($row[st] == 6) { $instaliran = 1; }; |
|
103 |
} |
} |
104 |
} else { |
if ($row[st] == 6) { $instaliran = 1; }; |
105 |
|
$nr++; |
106 |
|
} |
107 |
|
|
108 |
|
if ($nr == 0) { |
109 |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
$statusi.="<p><big>Nema podataka o korisničkom računu</big>"; |
110 |
} |
} |
111 |
|
|
112 |
|
|
113 |
$result = pg_Exec ($conn, "select racuni.login as login, |
$sth = $dbh->prepare("select racuni.login as login, |
114 |
racuni.passwd as passwd,e_mail.alias as email |
racuni.passwd as passwd,e_mail.alias as email |
115 |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
where racuni.osoba_id=$id and e_mail.osoba_id=$id"); |
116 |
|
$sth->execute(); |
117 |
|
|
118 |
if (pg_numrows($result) > 0) { |
if ($row=$sth->fetchrow_hash()) { |
|
$row=pg_fetch_array($result,0); |
|
119 |
|
|
120 |
print " |
print " |
121 |
<h1>Podaci o korisničkom računu</h1> |
<h1>Podaci o korisničkom računu</h1> |
167 |
|
|
168 |
$statusi.="<td><select name=status_tip_id>"; |
$statusi.="<td><select name=status_tip_id>"; |
169 |
|
|
170 |
$result = pg_Exec ($conn, "select id,opis |
$sth = $dbh->prepare("select id,opis |
171 |
from status_tip |
from status_tip |
172 |
where id >= 5 |
where id >= 5 |
173 |
"); |
"); |
174 |
|
$sth->execute(); |
175 |
|
|
176 |
$num_prava=0; |
$num_prava=0; |
177 |
|
|
178 |
for ($i=0; $i<pg_numrows($result); $i++) { |
while ($row=$sth->fetchrow_hash()) { |
|
$row=pg_fetch_array($result,$i); |
|
179 |
if ($prava & pow(2,$row[id])) { |
if ($prava & pow(2,$row[id])) { |
180 |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
$statusi.="<option value=$row[id]>$row[opis]</option>\n"; |
181 |
$num_prava++; |
$num_prava++; |
198 |
<hr> |
<hr> |
199 |
"; |
"; |
200 |
|
|
201 |
} else { // pg_numrows($result) > 0 |
} else { // nema rezultata |
202 |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
print "<p><big>Nema podataka o osobi sa id-jem $id</big>"; |
203 |
} // pg_numrows($result) > 0 |
} |
204 |
|
|
205 |
include("inc/obavjest-forma.inc"); |
include("inc/obavjest-forma.inc"); |
206 |
|
|