/[informatika.old]/html/obavijest.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /html/obavijest.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations)
Fri Jan 25 14:47:46 2002 UTC (21 years ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.20: +9 -10 lines
sap organizacijske jedinice

1 <?
2
3 include("inc/head.inc");
4 include("inc/prava.inc");
5 include("inc/print_bool2.inc");
6 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") {
12 $result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
13 $korow=pg_fetch_array($result,0);
14 # print "--$korow[passwd] | $md5_passwd | $passwd ";
15 $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>";
17 $curr_md5_passwd=md5($korow[passwd]);
18 if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) ||
19 (isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) {
20 include("inc/auth.inc");
21 $what="auth";
22 echo "<big>Upisana je neispravna loznika!</big>";
23 session_destroy();
24 print '<p><a href="index.php">Povratak na poèetnu stranicu</a>';
25 } else {
26 session_register("md5_passwd");
27 $md5_passwd=md5($korow[passwd]);
28 }
29 }
30
31 #print "--$pr_ko--";
32
33 if (! isset($kontakt_osoba_id)) {
34 include("inc/auth.inc");
35 $what="auth";
36
37 } elseif (! isset($id)) {
38 include("inc/obavjest-forma.inc");
39 } elseif (isset($id) && $what!="auth") {
40
41
42 $result = pg_Exec ($conn, "
43 select osobe.id as id,ime,prezime,tel,lokacije.naziv as lok,sifra,
44 lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje,
45 umrezavanje,shell
46 from osobe
47 where osobe.id=$id
48 and lokacija_id=lokacije.id
49 order by lokacije.naziv
50 ");
51
52 if (pg_numrows($result) > 0) {
53 $row=pg_fetch_array($result,0);
54
55 print "
56 <h1>Podaci o osobi</h1>
57
58 <table>
59 <tr><td><small>Ime i prezime:</small></td>
60 <td>$row[ime] $row[prezime]</td>
61 <td><small>Tel:</small> $row[tel]</td></tr>
62 <tr><td><small>Org. jedinica:</small></td>
63 <td rowspan=2>".sap_org_jed($row[sifra])." </td>
64 <td><small>©ifra radnika:</small> $row[sifra]</td></tr>
65 <tr><td></td>
66 <td><small>Lokacija raèunala:</small></td></tr>
67 <tr><td><small>Lokacija:</small></td>
68 <td>$row[lok]</td>
69 <td>$row[lokrac]</td></tr>
70 <tr><td><small>Objekt/soba/kat:</small></td>
71 <td>$row[objekt] / $row[soba] / $row[kat]</td>
72 <td><small>® raèunala:</small> $row[z_rac]</td></tr>
73 <tr><td>Shell: ".print_bool($row[shell])."</td>
74 <td>Umre¾avanje: ".print_bool($row[umrezavanje])."</td>
75 <td>Pode¹avanje: ".print_bool($row[podesavanje])."</td>
76 </table>
77 ";
78
79
80 if ($prava & $pr_promjena) {
81 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
105
106 $instaliran=0;
107
108 $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
110 where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id
111 and status.osoba_id=$id order by datum");
112
113 $statusi="";
114
115 $nr = pg_numrows($result);
116 if ($nr > 0) {
117 for ($i=0; $i<$nr; $i++) {
118 $row=pg_fetch_array($result,$i);
119 if ($row[st] != 2) {
120 $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 } else {
127 $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 if (pg_numrows($result) > 0) {
138 $row=pg_fetch_array($result,0);
139
140 print "
141 <h1>Podaci o korisnièkom raèunu</h1>
142
143 <form action=$PHP_SELF method=post>
144
145 <table>
146 <tr><td>Korisnièka oznaka:</td><td><tt>$row[login]</tt></td></tr>
147 ";
148 if ($prava & $pr_instalacija || $prava & $pr_lozinke) {
149 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 {
182 print "<tr><td colspan=2><i>Nemate ovla¹tenja vidjeti lozinku ovog korisnika!</i></td></tr>";
183 }
184 print "
185 <tr><td>E-mail adresa:</td><td><tt>$row[email]@pliva.hr</tt></td></tr>
186 </table>
187 ";
188
189 } else {
190 print "<p><big>Nema podataka o korisnièkom raèunu</big>";
191 }
192
193
194 print "
195 </form>
196
197 <h1>Podaci o statusima korisnièkog raèuna</h1>
198
199 <form action=oznaci.php>
200 <input type=hidden name=kontakt_osoba_id value=$kontakt_osoba_id>
201 <input type=hidden name=osoba_id value=$id>
202
203 <table border=0>
204 <tr><th>datum</th><th>status</th><th>status postavio/la</th></tr>
205 $statusi";
206
207 $statusi="<tr>";
208
209 if ($prava == $pr_admin) {
210 $statusi.="<td><select name=date_offset>
211 <option value=>danas</option>
212 <option value=1>sutra</option>";
213 $dani=array("nedjelju","ponedjeljak","utorak","srijedu",
214 "èetvrtak","petak","subotu");
215 for ($d=2; $d<10; $d++) {
216 $statusi.="<option value=$d>u ".$dani[(date("w")+$d) % 7].", ". date("d.m.Y",time()+$d*24*60*60)."</option>";
217 }
218 $statusi.="</select></td>";
219 } else {
220 $statusi.="<td align=right><b>Dodati status:</b></td>";
221 }
222
223 $statusi.="<td><select name=status_tip_id>";
224 $min_status=5;
225 if ($prava==$pr_admin) $min_status=3;
226
227 $result = pg_Exec ($conn, "select id,opis
228 from status_tip
229 where id >= $min_status
230 ");
231
232 $num_prava=0;
233
234 for ($i=0; $i<pg_numrows($result); $i++) {
235 $row=pg_fetch_array($result,$i);
236 if ($prava & pow(2,$row[id])) {
237 $statusi.="<option value=$row[id]>$row[opis]</option>\n";
238 $num_prava++;
239 }
240 }
241
242 $statusi.="</select></td>
243 <td>$korow[ime] $korow[prezime]</td>
244 <td><input type=submit value=\"Dodaj\"></td></tr>";
245
246 if ($num_prava>0) {
247 print "$statusi";
248 }
249
250 print "
251 </table>
252 </form>
253
254 <small>Broj trenutnog zahtjeva: $id</small>
255 <hr>
256 ";
257
258 } else { // pg_numrows($result) > 0
259 print "<p><big>Nema podataka o osobi sa id-jem $id</big>";
260 } // pg_numrows($result) > 0
261
262 include("inc/obavjest-forma.inc");
263
264 } // isset($id)
265
266 print "<p>Povratak na ";
267 if (isset($HTTP_REFERER)) {
268 print "<a href=\"$HTTP_REFERER\">stranicu sa koje ste do¹li</a> ili ";
269 }
270 print "<a href=\"/\">poèetnu stranicu</a>.";
271
272
273 include("inc/footer.inc");
274
275 ?>
276

  ViewVC Help
Powered by ViewVC 1.1.26