/[useradm]/otvori_nove+db
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 /otvori_nove+db

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

revision 1.6 by dpavlin, Wed May 17 09:57:22 2000 UTC revision 1.7 by dpavlin, Wed May 31 13:57:49 2000 UTC
# Line 41  my $mail_login; Line 41  my $mail_login;
41  my @mail_to;            # array to main initial message to  my @mail_to;            # array to main initial message to
42  open(WHO,"who am i |") || die "who am i? $!";  open(WHO,"who am i |") || die "who am i? $!";
43  my $db_user=<WHO>;  my $db_user=<WHO>;
44    chomp $db_user;
45  $db_user=~s/\s.+$//g;  $db_user=~s/\s.+$//g;
46  close(WHO);  close(WHO);
47    
48  xdebug "koristim korinika $db_user\n";  xdebug "koristim korinika $db_user\n";
49    
50    open(HOSTNAME,"hostname |") || die "hostname: $!";
51    my $hostname=<HOSTNAME>;
52    chomp $hostname;
53    close(HOSTNAME);
54    
55    xdebug "koristim hostname $hostname\n";
56    
57  v "/etc/aliases\n";  v "/etc/aliases\n";
58  open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!";  open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!";
# Line 105  sub nuke_chars { Line 112  sub nuke_chars {
112  my $max_osoba_id=0;  my $max_osoba_id=0;
113    
114  my $dbh = DBI->connect("DBI:Pg:dbname=informatika;host=support.pliva.hr;user=$db_user","","") || die $DBI::errstr;  my $dbh = DBI->connect("DBI:Pg:dbname=informatika;host=support.pliva.hr;user=$db_user","","") || die $DBI::errstr;
115  my $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr();  
116    my $sth = $dbh->prepare("select ko_id from unix2ko where login='$db_user' and host='$hostname'") || die $dbh->errstr();
117    $sth->execute() || die $sth->errstr();
118    my ($ko_id)=$sth->fetchrow_array;
119    
120    xdebug "upotrebljavam ID kontakt osobe: $ko_id\n";
121    
122    $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr();
123  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
124  my ($last_open)=$sth->fetchrow_array;  my ($last_open)=$sth->fetchrow_array;
125    
126  if (! defined($open_only_id)) {  if (! defined($open_only_id)) {
127          $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr();          $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr();
128  } else {  } else {
# Line 237  while (my ($osoba_id,$ime,$prezime,$sifr Line 252  while (my ($osoba_id,$ime,$prezime,$sifr
252          system "mkdir -p $dir ; mkdir $dir/bin ; \          system "mkdir -p $dir ; mkdir $dir/bin ; \
253                  chown -R $uid:$group_id{$group} $dir ; chmod 755 $dir" if (! $debug);                  chown -R $uid:$group_id{$group} $dir ; chmod 755 $dir" if (! $debug);
254    
255          $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,3,'now'::datetime,3)") if (! $debug);          $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,$ko_id,'now'::datetime,3)") if (! $debug);
256    
257          $max_osoba_id = $osoba_id if ($max_osoba_id < $osoba_id) ;          $max_osoba_id = $osoba_id if ($max_osoba_id < $osoba_id) ;
258  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26