home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
ims.cab
/
smseshd.asp
< prev
next >
Wrap
Text File
|
1997-10-12
|
8KB
|
311 lines
<% Response.Expires = 0 %>
<%
REM LOCALIZATION
L_NOUSERS_TEXT = "There are no currently active sessions"
L_PAGETITLE_TEXT = "Microsoft SMTP Server Administration"
L_DISCONNECTALL_TEXT = "Are you sure you want to disconnect all users?"
L_DISCONNECTUSER_TEXT = "Are you sure you want to disconnect this user?"
REM END LOCALIZATION
%>
<% REM Get starting number for groups to show %>
<% startNum = Request("startNum") %>
<% REM if startNum has a value then use it, otherwise use start value of 1 %>
<% if (startNum = "") then %>
<% startNum = 1 %>
<% end if %>
<% startNumClean = startNum %>
<% REM Set number of groups to display per page %>
<% SessionsPerPage = 5 %>
<% svr = Request("svr") %>
<% save = Request("save") %>
<% id = Request("id") %>
<% username = Request("username") %>
<% Host = Request("Host") %>
<% UserId = Request("UserId") %>
<!--#include file="_cnst.asp" -->
<% if (cont = true) then %>
<% REM create admin object %>
<% On Error Resume Next %>
<% set adminObj = Server.CreateObject("SmtpAdm.Admin.1") %>
<% if (Err <> 0) then %>
<script language="javascript">
alert('<% = Err.description %>');
</script>
<% end if %>
<% adminObj.server = svr %>
<% REM create sessions object %>
<% On Error Resume Next %>
<% set sessionObj = Server.CreateObject("SmtpAdm.Sessions.1") %>
<% if (Err <> 0) then %>
<script language="javascript">
alert('<% = Err.description %>');
</script>
<% end if %>
<% REM set sessions object server %>
<% sessionObj.server = svr %>
<% REM set sessions object service instance %>
<% sessionObj.serviceInstance = Session("ServiceInstance") %>
<HTML>
<HEAD>
<TITLE><% = L_PAGETITLE_TEXT %></TITLE>
<% REM Disconnect and Disconnect All %>
<% if (save = "disconnect") then %>
<% sessionObj.Enumerate %>
<% sessionObj.UserId = UserId %>
<% On Error Resume Next %>
<% sessionObj.Terminate %>
<% if (Err <> 0 ) then %>
<SCRIPT LANGUAGE = "javascript">
alert("<% = Err.description %>");
</SCRIPT>
<% else %>
<SCRIPT LANGUAGE="javascript">
self.location = "smseshd.asp?svr=<% = svr %>"
</SCRIPT>
<% end if %>
<% elseif (save = "disconnectall" ) then %>
<% On Error Resume Next %>
<% sessionObj.Enumerate %>
<% if (Err <> 0) then %>
<SCRIPT LANGUAGE="javascript">
alert ("% = Err.description %>");
</SCRIPT>
<% end if %>
<% On Error Resume Next %>
<% sessionObj.TerminateAll %>
<% if (Err <> 0) then %>
<SCRIPT LANGUAGE="javascript">
alert ("<% = Err.description %>");
</SCRIPT>
<% else %>
<SCRIPT LANGUAGE="javascript">
self.location = "smseshd.asp?svr=<% = svr %>"
</SCRIPT>
<% end if %>
<% end if %>
<script language="javascript">
<% REM Create uForm object and methods %>
var uForm = new Object();
uForm.itemList = new Array();
uForm.startNum = "<% = startNum %>";
uForm.SessionsPerPage = <% = SessionsPerPage %>;
uForm.selectedItem = uForm.startNum - 1;
uForm.disconnectUser = disconnectUser;
uForm.disconnectAll = disconnectAll;
uForm.selectItem = selectItem;
uForm.loadList = loadList;
uForm.next = next;
uForm.previous = previous;
uForm.refresh = refresh;
<% REM get currently active sessions %>
<% REM Enumerate sessions %>
<% On Error Resume Next %>
<% sessionObj.Enumerate %>
<% if ( Err <> 0 ) then %>
alert ( "<% = Err.description %>" );
<% end if %>
<% REM get number of active sessions %>
<% numSessions = sessionObj.Count %>
uForm.numSessions = "<% = numSessions %>";
<% if (numSessions = 0) then %>
<% startNumClean = 0 %>
<% End If %>
uForm.startNumClean = "<% = startNumClean %>";
<% i = startNum - 1 %>
<% REM counter for uForm object array %>
var i = <% = startNum - 1 %>;
<% REM loop through active sessions %>
<% While( (i < numSessions) AND ( i < (startNum + SessionsPerPage - 1) ) ) %>
<% REM get each session %>
<% sessionObj.GetNth(i) %>
<% REM create a new uForm object for each active session and set properties %>
uForm.itemList[i] = new Object();
uForm.itemList[i].id = "<% = i %>";
username = "<% = sessionObj.UserName %>";
if( username == "" )
{
username = "unknown";
}
uForm.itemList[i].username = "<% = sessionObj.UserName %>";
uForm.itemList[i].Host = "<% = sessionObj.Host %>";
uForm.itemList[i].StartTime = "<% = sessionObj.ConnectTime %>";
uForm.itemList[i].UserId = "<% = sessionObj.UserId %>";
i++;
<% i = i + 1 %>
<% Wend %>
<% startNum = startNum + SessionsPerPage %>
top.menu.document.hiddenform.nSessionListStart.value = "<% = startNum %>";
function next()
{
if( parseInt(top.menu.document.hiddenform.nSessionListStart.value) <= parseInt(uForm.numSessions) )
{
parent.head.location = "smseshd.asp?svr=<% = svr %>&startNum=" +
top.menu.document.hiddenform.nSessionListStart.value;
}
}
function previous()
{
sum = uForm.SessionsPerPage + 1;
if( sum != parseInt(top.menu.document.hiddenform.nSessionListStart.value) )
{
parent.head.location = "smseshd.asp?svr=<% = svr %>&startNum=" +
(top.menu.document.hiddenform.nSessionListStart.value - ( uForm.SessionsPerPage * 2 ) );
}
}
function refresh()
{
parent.head.location = "smseshd.asp?svr=<% = svr %>&startNum=";
}
<% REM Javascript function selectItem (if IE, reloads list at specified position -- broken in Netscape) %>
function selectItem(index)
{
uForm.selectedItem = index;
<% if Instr(Request.ServerVariables("HTTP_USER_AGENT"),"IE") then %>
if (index == 0)
{
parent.list.location = "smsesls.asp"
}
else
{
parent.list.location = "smsesls.asp#" + (index-1);
}
<% else %>
parent.list.location = "smsesls.asp"
<% end if %>
}
function disconnectAll()
{
if (uForm.numSessions > 0)
{
if (confirm("<%= L_DISCONNECTALL_TEXT %>"))
{
self.location = "smseshd.asp?save=disconnectall&svr=<% = svr %>";
}
}
else
{
alert("<% = L_NOUSERS_TEXT %>");
}
}
function disconnectUser()
{
if (uForm.numSessions > 0)
{
if (confirm("<%= L_DISCONNECTUSER_TEXT %>"))
{
if( uForm.itemList[uForm.selectedItem].username == "unknown" )
{
usernameToDelete = "";
}
else
{
usernameToDelete = uForm.itemList[uForm.selectedItem].username;
}
self.location = "smseshd.asp?save=disconnect&svr=<% = svr %>&username=" + usernameToDelete + "&Host=" + uForm.itemList[uForm.selectedItem].Host + "&UserId=" + uForm.itemList[uForm.selectedItem].UserId;
}
}
else
{
alert("<% = L_NOUSERS_TEXT %>");
}
}
<% REM Javascript function loadList loads list frame after header is completed %>
function loadList()
{
parent.list.location = "smsesls.asp?svr=<% = svr %>";
}
</script>
</HEAD>
<BODY BGCOLOR="#CCCCCC" TEXT="#000000" TOPMARGIN=10>
<TABLE cellpadding="2" cellspacing="0" WIDTH="425" BORDER="0">
<TR>
<TD COLSPAN=4>
<P><IMG SRC="images/gnicttl.gif" ALIGN="textmiddle" HEIGHT=10 WIDTH=10> <FONT SIZE=2 FACE="Arial"><B>Current Sessions on </B></FONT><FONT SIZE=3 FACE="Times New Roman"><I><% = svr %></I><BR> </FONT>
</TD>
</TR>
<TR>
<TD WIDTH=25>
</TD>
<TD COLSPAN=3>
<FONT SIZE=2 FACE="Arial">
<% If (numSessions <> 0) Then %>
Results: <b><% = startNumClean %></b> - <b><% if( (startNumClean + SessionsPerPage - 1) < numSessions ) then %>
<% = startNumClean + SessionsPerPage - 1 %><% else %><% = numSessions %><% end if %></b> out of <b><% = numSessions %></b></br>
<% Else %>
<b><% = L_NOUSERS_TEXT %></b><br>
<% End If %>
</FONT>
</TD>
</TR>
<TR>
<TD WIDTH=25> </TD>
<TD WIDTH=125 ALIGN="left">
<FONT SIZE=2 FACE="Arial"><B>User</B></FONT>
</TD>
<TD WIDTH=125 ALIGN="left">
<FONT SIZE=2 FACE="Arial"><B>From</B></FONT>
</TD>
<TD WIDTH=150 ALIGN="left">
<FONT SIZE=2 FACE="Arial"><B>Time</FONT>
</TD>
</TR>
</TABLE>
<% REM Load list page after head has completely loaded %>
<SCRIPT LANGUAGE="javascript">
timeList = setTimeout('loadList()',500);
</SCRIPT>
</BODY>
</HTML>
<% end if %>