2016-07-30 102 views
-2

我的公司希望讓我重新設計他們的服務軟件。我正在查看一些舊代碼。它看起來像VB和HTML的組合。是對的嗎?他們使用的服務器有幾個訪問數據庫。 Idk有關訪問的任何信息。這些命令看起來與SQL非常類似,除了標識符的括號外。這裏可能是rudamentary信息。我計劃將其重寫爲Visual Studio中的公共應用程序。ASP登錄頁面內容

<% 
msgTxt = Request("msgTxt") 
If Request("Action") = "Log on" Then 
     sql = "SELECT [ID], [Password]" 
     sql = sql & " FROM [tbl Employees]" 
     sql = sql & " WHERE [ID] = '" & Request("EmpID") & "' AND [Password] = '" & Request("Password") & "'" 
     sql = sql & ";" 
     Set rs_logon = Session("Conn").execute(sql) 
     On Error Resume Next 
    empId = rs_logon("ID") 
     If empId <> "" AND Err.Number = 0 Then 
     On Error Goto 0 
       Session("svEmp") = empId 
       SQL = "SELECT [ID] FROM [tbl Employees] WHERE [ID] = '" & Session("svEmp") & "';" 
     set rs_emp = Session("Conn").Execute(SQL) 
      Session("svEmp") = rs_emp("ID") 
      Session("lastCompanyViewed") = "0" 

     SQL = "UPDATE DISTINCTROW [tbl Employees] SET " 
     SQL = SQL & "[Online] = True " 
     SQL = SQL & "WHERE [ID]='" & Session("svEmp") & "';" 
     Session("Conn").Execute(SQL) 
       redirTo = "default.asp" 
       If Request("referrer") <> "" Then 
         redirTo = Request("referrer") 
       End If 
     Response.Redirect redirTo 
     Else 
       msgTxt = "Sorry. That set of credentials is invalid." 
       Session("svEmp") = "" 
     End If 
End If 
If Request("Action") = "Log off" Then 
     SQL = "UPDATE DISTINCTROW [tbl Employees] SET " 
     SQL = SQL & "[Online] = False " 
     SQL = SQL & "WHERE [ID]='" & Session("svEmp") & "';" 
     Session("Conn").Execute(SQL) 
       Session("svEmp") = "" 
       redirTo = "logon.asp" 
     Response.Redirect redirTo 
End If 
%> 
<html> 
<head> 
<link rel="stylesheet" type="text/css" href="cogs.css" /> 
    <title>Log on</title> 
</head> 
<body background="" onload="javascript:if(document.all.EmpID.value==''){document.all.EmpID.focus();}"> 
    <table border="0" cellpadding="0" cellspacing="0" align="center"> 
    <tr style="height:28px;"> 
    <td style="height:28px;width:28px;background:url('images/blue_top_left.jpg');"></td> 
    <td style="height:28px;background:url('images/blue_top.jpg');"></td> 
    <td style="height:28px;width:28px;background:url('images/blue_top_right.jpg');"></td> 
    </tr> 
    <tr> 
    <td style="width:28px;background:url('images/blue_left.jpg');"></td> 
    <td style="background-color:2C9FF0;" align="center"> 
    <div align="center"><img src="images/rt_logo.gif"></div> 
    <br> 
    <%=msgTxt%> 
    <form method="post"> 
    <div>Identification:</div> 
    <input type="text" name="EmpID"> 
    <div>Password:</div> 
    <input type="password" name="Password"> 
    <br><br> 
    <br> 
    <input type="submit" class="button" name="Action" value="Log on" class="button"> 
    </form> 
    <br> 
    <div align="center"><img src="images/cogs_logo.gif"></div> 
    <div>&copy; <%=DatePart("yyyy",Date())%> ---------------------------, Inc.</div> 
    </td> 
    <td style="width:28px;background:url('images/blue_right.jpg');"></td> 
    <tr> 
    <tr style="height:28px;"> 
    <td style="height:28px;width:28px;background:url('images/blue_bottom_left.jpg');"></td> 
    <td style="height:28px;background:url('images/blue_bottom.jpg');"></td> 
    <td style="height:28px;width:28px;background:url('images/blue_bottom_right.jpg');"></td> 
    </tr> 
    <tr> 
    <td colspan="3" align="center"> 
    </td> 
    </tr> 
    </table> 
    <div align="center"> 
    <div><strong>This site is for the sole use of ------------ and its employees. All other use is strictly prohibited.</strong></div> 
    </div> 
    <%=Session("svEmp")%> 
</body> 
</html> 
+0

您有任何具體問題嗎? – Andrei

+0

**它看起來像VB和HTML的組合。是對的嗎?** – Flibertyjibbet

回答

0

這是一個經典的aspx頁面。 <%>>標記是服務器標記,它們是變量或服務器端函數的佔位符。通常,頁面後面的代碼與aspx頁面具有相同的名稱,但是具有帶有服務器端代碼的vb擴展名。