--- html/obavijest.php 2000/07/31 18:30:49 1.15.2.1 +++ html/obavijest.php 2001/10/03 15:18:06 1.20 @@ -4,11 +4,12 @@ include("inc/prava.inc"); include("inc/print_bool2.inc"); include("inc/bgcolor.inc"); +include("inc/show_bool.inc"); +include("inc/auth_pop3.inc"); if (isset($kontakt_osoba_id) && $what!="relogin") { - $sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); - $sth->execute(); - $korow=$sth->fetchrow_hash(); + $result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); + $korow=pg_fetch_array($result,0); # print "--$korow[passwd] | $md5_passwd | $passwd "; $prava=$korow[prava]; print "Trenutno ste prijavljeni kao $korow[ime] $korow[prezime], ako je to krivo odaberite ovaj link."; @@ -36,7 +37,8 @@ include("inc/obavjest-forma.inc"); } elseif (isset($id) && $what!="auth") { -$sth = $dbh->prepare(" + +$result = pg_Exec ($conn, " select osobe.id as id,ime,prezime,tel,lokacije.naziv as lok,sifra, org_jed.naziv as orgjed,org_pod_jed.pod_naziv as orgpodjed, lok_racunala as lokrac,objekt,kat,soba,z_rac,podesavanje, @@ -48,9 +50,8 @@ order by lokacije.naziv,org_jed.naziv "); -$sth->execute(); - -if ($row=$sth->fetchrow_hash()) { +if (pg_numrows($result) > 0) { + $row=pg_fetch_array($result,0); print "

Podaci o osobi

@@ -82,49 +83,102 @@ print "[promjeni podatke o osobi]"; } +// update nove lozinke i upis statusa +if (($prava & $pr_lozinke) && $update_newpasswd) { + $result = pg_Exec ($conn, "select login,passwd from racuni where id=$racuni_id"); + $row=pg_fetch_array($result,0); + + include("inc/poppassd.inc"); + $tmp=poppassd($row[login],$row[passwd],$newpasswd); + + if ($tmp[0]) { + + $sql="update racuni set passwd='$newpasswd' where racuni.id=$racuni_id"; + pg_Exec ($conn, "$sql"); + $sql="insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($id,$kontakt_osoba_id,'now'::datetime,7)"; + $result = pg_Exec ($conn, $sql); + $promjena_lozinke_result="Lozinka upisana! ".$tmp[1]; + } else { + $promjena_lozinke_result="Greška: ".$tmp[1]; + } +} + // kreiraj statuse, zapamti da li je instaliran $instaliran=0; -$sth = $dbh->prepare("select status.id as status_id,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 from status,kontakt_osobe,status_tip where kontakt_osoba_id=kontakt_osobe.id and status_tip_id=status_tip.id - and osoba_id=$id order by datum"); -$sth->execute(); + and status.osoba_id=$id order by datum"); $statusi=""; -$nr=0; -while($row=$sth->fetchrow_hash()) { - if ($row[st] != 2) { - $statusi.="$row[datum]$row[opis]$row[ime] $row[prezime]"; - } else { - $statusi.="$row[datum]$row[opis]$row[ime] $row[prezime]"; +$nr = pg_numrows($result); +if ($nr > 0) { + for ($i=0; $i<$nr; $i++) { + $row=pg_fetch_array($result,$i); + if ($row[st] != 2) { + $statusi.="$row[datum]$row[opis]$row[ime] $row[prezime]"; + } else { + $statusi.="$row[datum]$row[opis]$row[ime] $row[prezime]"; + } + if ($row[st] == 6) { $instaliran = 1; }; } - if ($row[st] == 6) { $instaliran = 1; }; - $nr++; -} - -if ($nr == 0) { +} else { $statusi.="

Nema podataka o korisničkom računu"; } -$sth = $dbh->prepare("select racuni.login as login, - racuni.passwd as passwd,e_mail.alias as email +$result = pg_Exec ($conn, "select racuni.login as login, + racuni.passwd as passwd,e_mail.alias as email, + racuni.id as racuni_id where racuni.osoba_id=$id and e_mail.osoba_id=$id"); -$sth->execute(); -if ($row=$sth->fetchrow_hash()) { +if (pg_numrows($result) > 0) { + $row=pg_fetch_array($result,0); print "

Podaci o korisničkom računu

+
+ "; -if ($prava & $pr_instalacija) { - print ""; +if ($prava & $pr_instalacija || $prava & $pr_lozinke) { + print ""; } else { print ""; } @@ -139,6 +193,8 @@ print " + +

Podaci o statusima korisničkog računa

@@ -166,16 +222,18 @@ } $statusi.="
Korisnička oznaka:$row[login]
Lozinka:$row[passwd]
Lozinka:$row[passwd]"; + $passwd_ok="?"; + if ($check_pop) { + $pop3 = new POP3(); + $pop3->connect("intranet.pliva.hr"); + if ($pop3->checklogin($row[login],$row[passwd])) { + $passwd_ok="t"; + } else { + $passwd_ok="f"; + } + $pop3->quit(); + print show_bool($passwd_ok); + } else { + print " + + "; + } + if ($prava & $pr_lozinke) { + if ($input_newpasswd) { + print " + + + "; + + } elseif ($update_newpasswd) { + print $promjena_lozinke_result; + } else { + print " + "; + } + }// prava=pr_lozinke + print "
Nemate ovlaštenja vidjeti lozinku ovog korisnika!