Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9ae27aae

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 9ae27aaed7df10d51373d5ddf94d8479ade1071d
  • Vorgänger 2ecce44c
  • Nachfolger b513b1ef

Das Löschen von Session-Keys auch außerhalb von create_or_refresh_session() implementiert

Unterschiede anzeigen:

SL/Auth.pm
597 597

  
598 598
  if ($id) {
599 599
    do_query($form, $dbh, qq|UPDATE auth.session SET mtime = now() WHERE id = ?|, $session_id);
600
    do_query($form, $dbh, qq|DELETE FROM auth.session_content WHERE session_id = ?|, $session_id);
601 600

  
602 601
  } else {
603 602
    do_query($form, $dbh, qq|INSERT INTO auth.session (id, ip_address, mtime) VALUES (?, ?, now())|, $session_id, $ENV{REMOTE_ADDR});
......
617 616

  
618 617
  my $dbh          = $provided_dbh || $self->dbconnect();
619 618

  
620
  my $query        = qq|INSERT INTO auth.session_content (session_id, sess_key, sess_value) VALUES (?, ?, ?)|;
621
  my $sth          = prepare_query($::form, $dbh, $query);
619
  do_query($::form, $dbh, qq|DELETE FROM auth.session_content WHERE session_id = ?|, $session_id);
622 620

  
623
  foreach my $key (sort keys %{ $self->{SESSION} }) {
624
    do_statement($::form, $sth, $query, $session_id, $key, $self->{SESSION}->{$key});
621
  if (%{ $self->{SESSION} }) {
622
    my $query = qq|INSERT INTO auth.session_content (session_id, sess_key, sess_value) VALUES (?, ?, ?)|;
623
    my $sth   = prepare_query($::form, $dbh, $query);
624

  
625
    foreach my $key (sort keys %{ $self->{SESSION} }) {
626
      do_statement($::form, $sth, $query, $session_id, $key, $self->{SESSION}->{$key});
627
    }
628

  
629
    $sth->finish();
625 630
  }
626 631

  
627
  $sth->finish();
632
  $dbh->commit() unless $provided_dbh;
628 633
}
629 634

  
630 635
sub set_session_value {
......
640 645
  }
641 646

  
642 647
  $main::lxdebug->leave_sub();
648

  
649
  return $self;
650
}
651

  
652
sub delete_session_value {
653
  $main::lxdebug->enter_sub();
654

  
655
  my $self = shift;
656

  
657
  $self->{SESSION} ||= { };
658
  delete @{ $self->{SESSION} }{ @_ };
659

  
660
  $main::lxdebug->leave_sub();
661

  
662
  return $self;
663
}
664

  
665
sub get_session_value {
666
  $main::lxdebug->enter_sub();
667

  
668
  my $self  = shift;
669
  my $value = $self->{SESSION} ? $self->_load_value($self->{SESSION}->{ $_[0] }) : undef;
670

  
671
  $main::lxdebug->leave_sub();
672

  
673
  return $value;
643 674
}
644 675

  
645 676
sub set_cookie_environment_variable {

Auch abrufbar als: Unified diff