ASP Source Code

ASP File: vbscript/general/process/proc.asp

 
   ASP Script
   Comments
   HTML and Text

<html>
<head><title> Windows NT Task Manager </title><head>
<body bgcolor=white text=black>
<blockquote>
<h2><p align="center">Windows NT Task Manager</p></h2>
<p> <font color = red size = +2> Warning: </font></p>
<p> <font color=red size=+1> Selecting one of the Process ID's below will cause the server to attempt to <b>terminate</b> the selected process. Make sure you know what you are doing!</font></p>
<hr>
<p>
<%  
    dim idArray,nameArray,timeArray,sizeArray
    Set ProcList = Server.CreateObject("halcyon.demo.Proc")
    if Request.form("host") <> "" Then
            Session("host") = Request.form("host")
  	  Session("port") = Request.form("port")
  	  Session("userid") = Request.form("userid")
  	  Session("password") = Request.form("password")
    end if
    host = Session("host")
    port = Session("port")
    uid  = Session("userid") 
    pwd  = Session("password")
    adapter = "halcyon.rjax.comm.TCPClientAdapter"
    ProcList.init host, port, uid, pwd, adapter

    idArray = ProcList.GetProcessIDs
    nameArray = ProcList.GetProcessNames
    timeArray = ProcList.GetProcessExecuteTime
    sizeArray = ProcList.GetProcessMemorySize



    dim procid,index,pos,id
    
    procid = Request.Form("isKill")
    if procid <> "" Then
            procid = procid & ","
  	  pos = 1
  	  index = InStr(pos, procid, ",")
  	  While index <> 0
    		  id = idArray(Trim(Mid(procid, pos, index - pos)))
    		  if ProcList.Kill(id) then
      			  Response.Write("Process " & id & " terminated successfully<br>")
    		  else
      			  Response.Write("Process " & id & " termination failed<br>")
    		  end if
    		  pos = index + 1
    		  index = InStr(pos, procid, ",")
  	  Wend
  	  idArray = ProcList.GetProcessIDs
  	  nameArray = ProcList.GetProcessNames
  	  timeArray = ProcList.GetProcessExecuteTime
  	  sizeArray = ProcList.GetProcessMemorySize
    end if
%>
<form method = "post" action = "proc.asp">
<p align = "center"><input name="B1" type="submit" value=" Refresh "></p>
    <table border = 1 align="center">
        <tr>
  	   <td><b>Kill Process?</b></td>
  	   <td><b>Process_Name</b></td>
  	   <td><b>PID</b></td>
  	   <td><b>CPU_Time</b></td>
  	   <td><b>Memory Usage</b></td>
        </tr>
  	<%
  	l = Ubound(sizeArray) - 1
        for i = 0 to l
  	%>
  	    <tr>
    		  <td><input type = "checkbox" name = "iskill" value = "<%= i %>" ></td>
    		  <td><%= nameArray(i)%></td>
    		  <td><%= idArray(i)%></td>
    		  <td><%= timeArray(i)%></td>
    		  <td><%= sizeArray(i)%></td>
    		</tr>
        <%
  	next 
        %>
    </table>
</form>
</blockquote>
</body>
</html>