/[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

Diff of /html/obavijest.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by dpavlin, Wed May 10 06:26:12 2000 UTC revision 1.19 by dpavlin, Wed Oct 3 15:00:25 2001 UTC
# Line 1  Line 1 
1  <?  <?
2    
3  include("inc/head.inc");  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    
10    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");
12            $korow=pg_fetch_array($result,0);
13    #       print "--$korow[passwd] | $md5_passwd | $passwd ";
14            $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>";
16            $curr_md5_passwd=md5($korow[passwd]);
17            if ( (!isset($md5_passwd) && $korow[passwd] != $passwd) ||
18                    (isset($md5_passwd) && $curr_md5_passwd != $md5_passwd) ) {
19                    include("inc/auth.inc");
20                    $what="auth";
21                    echo "<big>Upisana je neispravna loznika!</big>";
22                    session_destroy();
23                    print '<p><a href="index.php">Povratak na početnu stranicu</a>';
24            } else {
25                    session_register("md5_passwd");
26                    $md5_passwd=md5($korow[passwd]);
27            }
28    }
29    
30    #print "--$pr_ko--";
31    
32    if (! isset($kontakt_osoba_id)) {
33            include("inc/auth.inc");
34            $what="auth";
35    
36  if (! isset($id)) {  } elseif (! isset($id)) {
37          include("inc/obavjest-forma.inc");          include("inc/obavjest-forma.inc");
38  } else {  } elseif (isset($id) && $what!="auth") {
39    
40    
41  $result = pg_Exec ($conn, "  $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                  lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje,
45                    umrezavanje,shell
46          from osobe          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 and org_jed_id=org_jed.id
# Line 40  if (pg_numrows($result) > 0) { Line 72  if (pg_numrows($result) > 0) {
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: ".print_bool($row[shell])."</td>
76            <td>Umrežavanje: ".print_bool($row[umrezavanje])."</td>
77            <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            $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
96    
97    $instaliran=0;
98    
99    $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
101            where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id
102            and status.osoba_id=$id order by datum");
103    
104    $statusi="";
105    
106    $nr = pg_numrows($result);
107    if ($nr > 0) {
108            for ($i=0; $i<$nr; $i++) {
109                    $row=pg_fetch_array($result,$i);
110                    if ($row[st] != 2) {
111                            $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  } else {  } else {
118          print "<p><big>Nema podataka o osobi sa id-jem $id</big>";          $statusi.="<p><big>Nema podataka o korisničkom računu</big>";
119  }  }
120    
121    
122  $result = pg_Exec ($conn, "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");
126    
127  if (pg_numrows($result) > 0) {  if (pg_numrows($result) > 0) {
# Line 56  if (pg_numrows($result) > 0) { Line 130  if (pg_numrows($result) > 0) {
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  <tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>  ";
138    if ($prava & $pr_instalacija || $prava & $pr_lozinke) {
139            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 {
172            print "<tr><td colspan=2><i>Nemate ovlaštenja vidjeti lozinku ovog korisnika!</i></td></tr>";
173    }
174            print "
175  <tr><td>E-mail adresa:</td><td><tt>$row[email]@pliva.hr</tt></td></tr>  <tr><td>E-mail adresa:</td><td><tt>$row[email]@pliva.hr</tt></td></tr>
176  </table>  </table>
177          ";          ";
# Line 67  if (pg_numrows($result) > 0) { Line 180  if (pg_numrows($result) > 0) {
180          print "<p><big>Nema podataka o korisničkom računu</big>";          print "<p><big>Nema podataka o korisničkom računu</big>";
181  }  }
182    
 $result = pg_Exec ($conn, "select datum,opis,ime,prezime  
         from status,kontakt_osobe,status_tip  
         where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id  
         and osoba_id=$id");  
183    
184          print "          print "
185  <h1>Podaci o statusima koriničkog računa</h1>  </form>
186    
187  <table>  <h1>Podaci o statusima korisničkog računa</h1>
 <tr><th>datum</th><th>status</th><th>status postavio/la</th></tr>";  
188    
189  $nr = pg_numrows($result);  <form action=oznaci.php>
190  if ($nr > 0) {  <input type=hidden name=kontakt_osoba_id value=$kontakt_osoba_id>
191          for ($i=0;$i<$nr; $i++) {  <input type=hidden name=osoba_id value=$id>
192                  $row=pg_fetch_array($result,$i);  
193                  print "<tr><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>";  <table border=0>
194    <tr><th>datum</th><th>status</th><th>status postavio/la</th></tr>
195    $statusi";
196    
197    $statusi="<tr>";
198    
199    if ($prava == $pr_admin) {
200            $statusi.="<td><select name=date_offset>
201                    <option value=>danas</option>
202                    <option value=1>sutra</option>";
203            $dani=array("nedjelju","ponedjeljak","utorak","srijedu",
204                    "četvrtak","petak","subotu");
205            for ($d=2; $d<10; $d++) {
206                    $statusi.="<option value=$d>u ".$dani[(date("w")+$d) % 7].", ". date("d.m.Y",time()+$d*24*60*60)."</option>";
207          }          }
208            $statusi.="</select></td>";
209  } else {  } else {
210          print "<p><big>Nema podataka o korisničkom računu</big>";          $statusi.="<td align=right><b>Dodati status:</b></td>";
211    }
212    
213    $statusi.="<td><select name=status_tip_id>";
214    $min_status=5;
215    if ($prava==$pr_admin) $min_status=3;
216    
217            $result = pg_Exec ($conn, "select id,opis
218                    from status_tip
219                    where id >= $min_status
220                    ");
221    
222            $num_prava=0;
223    
224            for ($i=0; $i<pg_numrows($result); $i++) {
225                    $row=pg_fetch_array($result,$i);
226                    if ($prava & pow(2,$row[id])) {
227                            $statusi.="<option value=$row[id]>$row[opis]</option>\n";
228                            $num_prava++;
229                    }
230            }
231    
232    $statusi.="</select></td>
233    <td>$korow[ime] $korow[prezime]</td>
234    <td><input type=submit value=\"Dodaj\"></td></tr>";
235    
236    if ($num_prava>0) {
237            print "$statusi";
238  }  }
239    
240  print "</table>";  print "
241    </table>
242    </form>
243    
244    <small>Broj trenutnog zahtjeva: $id</small>
245    <hr>
246    ";
247    
248    } else { // pg_numrows($result) > 0
249            print "<p><big>Nema podataka o osobi sa id-jem $id</big>";
250    }       // pg_numrows($result) > 0
251    
252    include("inc/obavjest-forma.inc");
253    
254  } // isset($id)  } // isset($id)
255    
256    print "<p>Povratak na ";
257    if (isset($HTTP_REFERER)) {
258            print "<a href=\"$HTTP_REFERER\">stranicu sa koje ste došli</a> ili ";
259    }
260    print "<a href=\"/\">početnu stranicu</a>.";
261    
262    
263    include("inc/footer.inc");
264    
265  ?>  ?>
266    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.26