I need to get some help changing an asp page with vbscript code to perlscript instead.
I tried to do it but there are parts I don't understand. Any help or guidance is very much appreciated.
the page is very basic but I lack the knowledge to do it on my own.
Thank you.
asp page:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = true
Response.charset="utf-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>URL Id By Host</title>
<link rel=stylesheet type="text/css" href="report.css" TITLE="wow" />
</head>
<body>
<%
dim myParameterString, myQueryString, myhost
If Request.QueryString("host"
) <> "" Then
myhost = Request.Querystring("host"
)
End If
%>
<form name="frmOne" id="frmOne" action="TMC_report.asp?hos
t=<%=reque
st.form("h
ost")%>" method="get">
<span class="host">Host:</span>
<span class="indentHost"><input type="text" name="host" /></span>
<input type="submit" value="Submit" name="btn_submit" />
</form>
<br />
<%
dim cn, rs, sql, host, i, strOrderBy, tmpOrderBy, zip
host = request.querystring("host"
)
strOrderBy = Request.QueryString("sortb
y")
Select Case strOrderBy
Case "pv_a"
tmpOrderBy = " ORDER BY sumaccess ASC"
Case "pv_d"
tmpOrderBy = " ORDER BY sumaccess DESC"
Case "gi_a"
tmpOrderBy = "ORDER BY groupId ASC"
Case "gi_d"
tmpOrderBy = "ORDER BY groupId DESC"
End Select
cn= "Driver={SQL Server};Server=xxx.xxx.x.x
x;Database
=databasen
ame;Uid=sa
;Pwd=passw
ord;"
Set rs = Server.CreateObject("ADODB
.Recordset
")
sql = "SELECT * FROM urlid_report_by_host where host like '" & myhost & "'" & tmpOrderBy
rs.Open sql, cn, 3,3
Dim colorset, c, numcolors, rlabel
colorset = split("#E6E8FA,#EEE0E5",",
")
numcolors = ubound(colorset)+1
%>
<table border="0" cellspacing="1" cellpadding="2" width="100%">
<tr>
<td class="head" valign="top">Host</td>
<td class="head" valign="top">URL Id</td>
<td class="head" valign="top">Group Id<br /><a href="TMC_report.asp?host=
<%=host%>&
amp;sortby
=gi_a&
btn_submit
=Submit"><
span class="link">ASC</span></a
>|<a href="TMC_report.asp?sortb
y=gi_d&
;host=<%=h
ost%>&
btn_submit
=Submit"><
span class="link">DESC</span></
a></td>
<td class="head" valign="top">Label</td>
<td class="head" valign="top">Access Views<br /><a href="TMC_report.asp?host=
<%=host%>&
amp;sortby
=pv_a&
btn_submit
=Submit"><
span class="link">ASC</span></a
>|<a href="TMC_report.asp?sortb
y=pv_d&
;host=<%=h
ost%>&
btn_submit
=Submit"><
span class="link">DESC</span></
a></td>
<td class="head" valign="top">Latitude</td>
<td class="head" valign="top">Longitude</td
>
<td class="head" valign="top">Zip Code</td>
</tr>
<%
if not rs.eof and request("btn_submit") = "Submit" then
while not rs.eof
response.write " <tr style=""background:" & colorset(c mod numcolors) & ";"">"
%>
<td class="body" align="center"><p><%=Ucase
(rs("Host"
))%></p></
td>
<td class="body" align="center" width="244"><p><a href="
http://xxx.xxxxxx.xxx/xx/xxxx.asp?id=<%=trim(rs("url_id")
)%>" target="_blank">
http://xxx.xxxxxx.xxx/xx/xxxx.asp?id=<%=trim(rs
("URL_Id")
)%></a></p
></td>
<td class="body" width="75" align="center"><p><%=trim(
rs("groupI
d"))%></p>
</td>
<%
rlabel = rs("label")
rlabel = replace(rlabel,"&","&"
)
%>
<td class="body"><p><%=rlabel%
></p></td>
<td class="body" width="75" align="center"><p><%=trim(
rs("sumacc
ess"))%></
p></td>
<td class="body" width="75" align="center"><p><%=trim(
rs("latitu
de"))%></p
></td>
<td class="body" width="75" align="center"><p><%=trim(
rs("longit
ude"))%></
p></td>
<%
if rs("Zip") <= "" OR ISNULL(rs("Zip")) then
zip = " <td class='nozip'><p>Not used</p></td>"
else
zip = " <td class='body' align='center'><p>" & rs("Zip") &"</p></td>"
end if
%>
<%=zip%>
</tr>
<%
c = c + 1
rs.MoveNext
wend
response.write " <tr>" & vbcrlf & " <td colspan='8' class='total'>Total number of records: " & rs.RecordCount & "</td>" & vbcrlf & " </tr>"
elseif host <> "" then
%>
<tr>
<td class="message" colspan=7><p>There are no records for host <%=Ucase(host)%>. Please try again.</p></td>
</tr>
<%
end if
response.write vbcrlf & "</table>"
%>
</body>
</html>
<%
rs.close
set rs=nothing
%>
Our community of experts have been thoroughly vetted for their expertise and industry experience.