ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/cgi-bin/moderator/sessions.pl  view on Meta::CPAN

use ASNMTAP::Asnmtap::Applications::CGI v3.002.003;
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :MODERATOR);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

use vars qw($PROGNAME);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$PROGNAME       = "sessions.pl";
my $prgtext     = "Blocked Sessions";
my $version     = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; # must be all on one line or MakeMaker will get confused.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

use CGI;
use DBI;
use Time::Local;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/htmlroot/cgi-bin/moderator/sessions.pl  view on Meta::CPAN

# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'modera...

# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=$action&sessionID=$CsessionID";

# Debug information
print "<pre>pagedir     : $pagedir<br>pageset     : $pageset<br>debug       : $debug<br>CGISESSID   : $sessionID<br>action      : $action<br>session ID  : $CsessionID<br>URL ...     : $urlAccessParameters</pre>" if ( $debug eq 'T' );

if ( defined $sessionID and ! defined $errorUserAccessControl ) {
  my ($matchingSessionDetails, $matchingSessionsBlocked, $matchingSessionsActive, $matchingSessionsExpired, $matchingSessionsEmpty, $navigationBar);

  my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID";

  if ($action eq 'deleteView') {
    $htmlTitle    = "Delete Session '$CsessionID'";
    $submitButton = "Delete";
    $nextAction   = "delete";
  } elsif ($action eq 'delete') {
    my $cgisessFilename = "cgisess_$CsessionID";

applications/htmlroot/cgi-bin/moderator/sessions.pl  view on Meta::CPAN

  } elsif ($action eq 'listView') {
    $htmlTitle    = "All sessions listed";

    my $actionPressend = ($iconDelete or $iconDetails) ? 1 : 0;
    my $actionHeader = ($actionPressend) ? "<th>Action</th>" : '';
    my $colspan = 7 + $actionPressend;

    my $table  = "\n      <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">\n";
    my $header = "        <tr><th> Session ID </th><th> Remote User </th><th> Name </th><th> IP address </th><th> Activated </th><th> Login Trials </th><th> eTime </th>$actionHeader</tr>\n";

    $matchingSessionsBlocked = "$table        <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><th colspan=\"$colspan\">Blocked Sessions</th></tr>\n$header";
    $matchingSessionsActive  = "$table        <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><th colspan=\"$colspan\">Active Sessions</th></tr>\n$header";
    $matchingSessionsExpired = "$table        <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><th colspan=\"$colspan\">Expired Sessions</th></tr>\n$header";
    $matchingSessionsEmpty   = "$table        <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><th colspan=\"$colspan\">Empty Sessions</th></tr>\n$header";

    my ($numberRecordsIntoQueryBlocked, $numberRecordsIntoQueryActive, $numberRecordsIntoQueryExpired, $numberRecordsIntoQueryEmpty);
    $numberRecordsIntoQueryBlocked = $numberRecordsIntoQueryActive = $numberRecordsIntoQueryExpired = $numberRecordsIntoQueryEmpty = 0;

    my $currentTime = time();
    my $solaris = (-e '/usr/sbin/nslookup') ? 1 : 0; # solaris

    @cgisessPathFilenames = glob("$CGISESSPATH/cgisess_*");

    foreach my $cgisessPathFilename (@cgisessPathFilenames) {
      my (undef, $cgisessFilename) = split (/^$CGISESSPATH\//, $cgisessPathFilename);
      (undef, $CsessionID) = split (/^cgisess_/, $cgisessFilename);
      my ($sessionExists, %session) = get_session_param ($CsessionID, $CGISESSPATH, $cgisessFilename, $debug);

applications/htmlroot/cgi-bin/moderator/sessions.pl  view on Meta::CPAN

 
          if ( $debug eq 'T' ) {
            $remoteAddr = 'c: '. scalar(localtime($currentTime));
            $remoteAddr .= ' A: '. scalar(localtime($sessionAtime)) if (defined $sessionAtime);
            $remoteAddr .= ' E: '. $sessionEtime .' ' if (defined $sessionEtime);
          }

          my $currentSession = "        <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$CsessionID</td><td>$remoteUser</td><td>$username</td><td>$remoteAddr</td><td>$activated</td><td align=\"right\">$loginTrials</td><td>" .scalar(localtime($sessionAti...

          if ( $loginTrials >= 3) {
            $numberRecordsIntoQueryBlocked++;
            $matchingSessionsBlocked .= $currentSession;
          } elsif (defined $sessionAtime and defined $sessionEtime and ($sessionAtime + $sessionEtime) <= $currentTime) {
            $numberRecordsIntoQueryExpired++;
            $matchingSessionsExpired .= $currentSession;
          } elsif (defined $loggedIn and $loggedIn) {
            $numberRecordsIntoQueryActive++;
            $matchingSessionsActive  .= $currentSession;
          } else {
            $numberRecordsIntoQueryEmpty++;
            $matchingSessionsEmpty   .= $currentSession;
          }
        } else {
          $numberRecordsIntoQueryEmpty++;
          $matchingSessionsEmpty   .= "        <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$CsessionID</td><td>&nbsp;</td><td>&nbsp;</td><td>$remoteAddr</td><td>&nbsp;</td><td align=\"right\">&nbsp;</td><td>" .scalar(localtime($sessionAtime)). "</td...
        }
      }
    }

    $matchingSessionsBlocked .= "        <tr><td colspan=\"$colspan\">No blocked sessions found for any user</td></tr>\n" unless ( $numberRecordsIntoQueryBlocked );
    $matchingSessionsBlocked .= "      </table>\n";

    $matchingSessionsActive  .= "        <tr><td colspan=\"$colspan\">No active sessions found for any user</td></tr>\n" unless ( $numberRecordsIntoQueryActive );
    $matchingSessionsActive  .= "      </table>\n";

    $matchingSessionsExpired .= "        <tr><td colspan=\"$colspan\">No expired sessions found for any user</td></tr>\n" unless ( $numberRecordsIntoQueryExpired );
    $matchingSessionsExpired .= "      </table>\n";

    $matchingSessionsEmpty   .= "        <tr><td colspan=\"$colspan\">No empty sessions found for any user</td></tr>\n" unless ( $numberRecordsIntoQueryEmpty );
    $matchingSessionsEmpty   .= "      </table>\n";

    $nextAction = "listView";
  } elsif ($action eq 'unblockView') {
    $htmlTitle    = "Unblock Session '$CsessionID'";
    $submitButton = "Unblock";
    $nextAction   = "unblock";
  } elsif ($action eq 'unblock') {
    my $cgisessFilename = "cgisess_$CsessionID";

    if (-e "$CGISESSPATH/$cgisessFilename") {
      unlink ($CGISESSPATH.'/'.$cgisessFilename);	
      $htmlTitle = "Session '$cgisessFilename' unblocked";
    } else {
      $htmlTitle = "Session '$cgisessFilename' not unblocked, doesn't exist";
    }
  }

  # HTML  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);

  if ($action eq 'deleteView' or $action eq 'unblockView') {
    print <<HTML;
<form action=\"$ENV{SCRIPT_NAME}\" method=\"post\" name=\"sessions\">

applications/htmlroot/cgi-bin/moderator/sessions.pl  view on Meta::CPAN

    <tr><td>
      <table border="0" cellspacing="0" cellpadding="0" align="center">
        <tr align="center"><td><br>$matchingSessionDetails</td></tr>
      </table>
    </td></tr>
HTML
  } else {
    print <<HTML;
    <tr><td>
      <table border="0" cellspacing="0" cellpadding="0" align="center">
        <tr align="center"><td><br>$matchingSessionsBlocked</td></tr>
        <tr align="center"><td><br>$matchingSessionsActive</td></tr>
        <tr align="center"><td><br>$matchingSessionsExpired</td></tr>
        <tr align="center"><td><br>$matchingSessionsEmpty</td></tr>
      </table>
    </td></tr>
HTML
  }

  print "  </table>\n";

applications/htmlroot/cgi-bin/moderator/trendlineCorrectionReports.pl  view on Meta::CPAN

# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'modera...

# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&sessionID=$CsessionID&shortlist=$shortlist&catalogID=$CcatalogID";

# Debug information
print "<pre>pagedir     : $pagedir<br>pageset     : $pageset<br>debug       : $debug<br>CGISESSID   : $sessionID<br>action      : $action<br>catalog ID  : $CcatalogID<br>catalog ID reload : $CcatalogIDreload<br>session ID  : $CsessionID<br>shortlist ...

if ( defined $sessionID and ! defined $errorUserAccessControl ) {
  my ($catalogIDSelect, $matchingSessionDetails, $matchingSessionsBlocked, $matchingSessionsActive, $matchingSessionsExpired, $matchingSessionsEmpty, $navigationBar);

  my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID&amp;catalogID=$CcatalogID";

  if ($action eq 'listView') {
    $htmlTitle = "Trendline Correction Reports";

    my ($rv, $dbh, $sth, $sql);
    $rv = 1;

    # open connection to database and query data

lib/ASNMTAP/Asnmtap/Applications/CGI.pm  view on Meta::CPAN

  }

  my $logonRequest = ($cgi->param('logonRequest') or "logonView");
  
  if( $logonRequest eq "logonView" or $logonRequest eq "logonCheck" ) {
    my $logonPassword  = ($cgi->param('logonPassword')     or undef);
    my $logonTimestamp = ($cgi->param('logonTimestamp')    or undef);
    my $loginTrials    = ($session->param('~login-trials') or 0);

    if ( $loginTrials >= 3 ) {
      $errorUserAccessControl = "You failed 3 times in a row.<br>Your session is blocked.<br>Please contact us with the details of your action";
    } elsif( $logonRequest eq "logonCheck" ) {
      my ($CremoteUser, $CremoteAddr, $CremoteNetmask, $CgivenName, $CfamilyName, $Cemail, $Cpassword, $CuserType, $Cpagedir, $Cactivated, $CkeyLanguage);
      $CremoteUser = ($cgi->param('remoteUser') or undef);
      $session->param('remoteUser', $CremoteUser) if (defined $CremoteUser);
      $CuserType = 0;

      if (defined $CremoteUser and defined $logonPassword and defined $logonTimestamp) {
        my $rv = 1;

        if (defined $CremoteUser) {



( run in 0.569 second using v1.01-cache-2.11-cpan-49f99fa48dc )