ASNMTAP

 view release on metacpan or  search on metacpan

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

            $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\">
  <input type="hidden" name="pagedir"   value="$pagedir">
  <input type="hidden" name="pageset"   value="$pageset">
  <input type="hidden" name="debug"     value="$debug">
  <input type="hidden" name="CGISESSID" value="$sessionID">
  <input type="hidden" name="action"    value="$nextAction">
  <input type="hidden" name="sessionID" value="$CsessionID">
HTML
  } else {
    print "<br>\n";
  }

  print <<HTML;
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr align="center"><td>
	  <table border="0" cellspacing="0" cellpadding="0">
        <tr><td class="StatusItem"><a href="$urlWithAccessParameters&amp;action=listView">[List all sessions]</a></td></tr>
      </table>
    </td></tr>
HTML

  if ($action eq 'deleteView' or $action eq 'unblockView') {
    print <<HTML;
    <tr><td>&nbsp;</td></tr>
    <tr><td>
      <table border="0" cellspacing="0" cellpadding="0">
        <tr><td><b>Session ID: </b></td><td><input type="text" name="sessionID" value="$CsessionID" size="40" maxlength="40" disabled></td></tr>
        <tr><td>&nbsp;</td><td><br><input type="submit" value="$submitButton">&nbsp;&nbsp;<input type="reset" value="Reset"></td></tr>
      </table>
    </td></tr>
HTML
  } elsif ($action eq 'delete' or $action eq 'unblock') {
    print "    <tr><td align=\"center\"><br><br><h1>Session ID: $htmlTitle</h1></td></tr>";
  } elsif ($action eq 'detailsView') {
    print <<HTML;
    <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";

  if ($action eq 'deleteView' or $action eq 'unblockView') {
    print "</form>\n";
  } else {
    print "<br>\n";
  }



( run in 0.983 second using v1.01-cache-2.11-cpan-ceb78f64989 )