/[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.6 by dpavlin, Thu Jun 1 07:48:01 2000 UTC revision 1.15.2.1 by dpavlin, Mon Jul 31 18:30:49 2000 UTC
# Line 2  Line 2 
2    
3  include("inc/head.inc");  include("inc/head.inc");
4  include("inc/prava.inc");  include("inc/prava.inc");
5    include("inc/print_bool2.inc");
6    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          $row=pg_fetch_array($result,0);          $sth->execute();
11  #       print "--$row[passwd] | $md5_passwd | $passwd ";          $korow=$sth->fetchrow_hash();
12          $prava=$row[prava];  #       print "--$korow[passwd] | $md5_passwd | $passwd ";
13          print "<small>Trenutno ste prijavljeni kao $row[ime] $row[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>";          $prava=$korow[prava];
14          $curr_md5_passwd=base64_encode(mhash(MHASH_MD5,$row[passwd]));          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          if ( (!isset($md5_passwd) && $row[passwd] != $passwd) ||          $curr_md5_passwd=md5($korow[passwd]);
16            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");
19                  $what="auth";                  $what="auth";
# Line 19  if (isset($kontakt_osoba_id) && $what!=" Line 22  if (isset($kontakt_osoba_id) && $what!="
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,$row[passwd]));                  $md5_passwd=md5($korow[passwd]);
26          }          }
27  }  }
28    
29  print "--$pr_ko--";  #print "--$pr_ko--";
30    
31  if (! isset($kontakt_osoba_id)) {  if (! isset($kontakt_osoba_id)) {
32          include("inc/auth.inc");          include("inc/auth.inc");
# Line 31  if (! isset($kontakt_osoba_id)) { Line 34  if (! isset($kontakt_osoba_id)) {
34    
35  } elseif (! isset($id)) {  } elseif (! isset($id)) {
36          include("inc/obavjest-forma.inc");          include("inc/obavjest-forma.inc");
37  } elseif (isset($id)) {  } 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                  lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje,
43                    umrezavanje,shell
44          from osobe          from osobe
45          where osobe.id=$id          where osobe.id=$id
46                  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 45  $result = pg_Exec ($conn, " Line 48  $result = pg_Exec ($conn, "
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>
# Line 67  if (pg_numrows($result) > 0) { Line 71  if (pg_numrows($result) > 0) {
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: ".print_bool($row[shell])."</td>
75            <td>Umrežavanje: ".print_bool($row[umrezavanje])."</td>
76            <td>Podešavanje: ".print_bool($row[podesavanje])."</td>
77  </table>  </table>
78          ";          ";
79  } else {  
80          print "<p><big>Nema podataka o osobi sa id-jem $id</big>";  
81    if ($prava & $pr_promjena) {
82            print "<small><a href=\"osoba.php?what=select-osoba&id=$id\">[promjeni podatke o osobi]</a></small>";
83  }  }
84    
85  // kreiraj statuse, zapamti da li je instaliran  // kreiraj statuse, zapamti da li je instaliran
86    
87  $instaliran=0;  $instaliran=0;
88    
89  $result = pg_Exec ($conn, "select 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                  $statusi.="<tr><td><small>$row[datum]</small></td><td>$row[opis]</td><td>$row[ime] $row[prezime]</td></tr>";          } else {
102                  if ($row[st] == 6) { $instaliran = 1; };                  $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>";
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>
# Line 109  if (pg_numrows($result) > 0) { Line 123  if (pg_numrows($result) > 0) {
123  <table>  <table>
124  <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>
125  ";  ";
126  if ($prava and $pr_instalacija) {  if ($prava & $pr_instalacija) {
127          print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>";          print "<tr><td>Lozinka:</td><td><tt>$row[passwd]</tt></td></tr>";
128  } else {  } else {
129          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>";
# Line 127  if ($prava and $pr_instalacija) { Line 141  if ($prava and $pr_instalacija) {
141          print "          print "
142  <h1>Podaci o statusima korisničkog računa</h1>  <h1>Podaci o statusima korisničkog računa</h1>
143    
144  <table>  <form action=oznaci.php>
145    <input type=hidden name=kontakt_osoba_id value=$kontakt_osoba_id>
146    <input type=hidden name=osoba_id value=$id>
147    
148    <table border=0>
149  <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>
150  $statusi  $statusi";
151  </table>";  
152    $statusi="<tr>";
153    
154    if ($prava == $pr_admin) {
155            $statusi.="<td><select name=date_offset>
156                    <option value=>danas</option>
157                    <option value=1>sutra</option>";
158            $dani=array("nedjelju","ponedjeljak","utorak","srijedu",
159                    "četvrtak","petak","subotu");
160            for ($d=2; $d<10; $d++) {
161                    $statusi.="<option value=$d>u ".$dani[(date("w")+$d) % 7].", ". date("d.m.Y",time()+$d*24*60*60)."</option>";
162            }
163            $statusi.="</select></td>";
164    } else {
165            $statusi.="<td align=right><b>Dodati status:</b></td>";
166    }
167    
168    $statusi.="<td><select name=status_tip_id>";
169    
170            $sth = $dbh->prepare("select id,opis
171                    from status_tip
172                    where id >= 5
173                    ");
174            $sth->execute();
175    
176            $num_prava=0;
177    
178            while ($row=$sth->fetchrow_hash()) {
179                    if ($prava & pow(2,$row[id])) {
180                            $statusi.="<option value=$row[id]>$row[opis]</option>\n";
181                            $num_prava++;
182                    }
183            }
184    
185    $statusi.="</select></td>
186    <td>$korow[ime] $korow[prezime]</td>
187    <td><input type=submit value=\"Dodaj\"></td></tr>";
188    
189    if ($num_prava>0) {
190            print "$statusi";
191    }
192    
193    print "
194    </table>
195    </form>
196    
197    <small>Broj trenutnog zahtjeva: $id</small>
198    <hr>
199    ";
200    
201    } else { // nema rezultata
202            print "<p><big>Nema podataka o osobi sa id-jem $id</big>";
203    }
204    
205    include("inc/obavjest-forma.inc");
206    
207  } // isset($id)  } // isset($id)
208    
209    print "<p>Povratak na ";
210    if (isset($HTTP_REFERER)) {
211            print "<a href=\"$HTTP_REFERER\">stranicu sa koje ste došli</a> ili ";
212    }
213    print "<a href=\"/\">početnu stranicu</a>.";
214    
215    
216    include("inc/footer.inc");
217    
218  ?>  ?>
219    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.15.2.1

  ViewVC Help
Powered by ViewVC 1.1.26