%
Dim connectionspeed
connectionspeed = 0
If Len(Request.QueryString("speed")) <= 1 Then
connectionspeed = "NarrowBand"
Else
connectionspeed = (Request.QueryString("speed"))
End If
%>
<%
Dim getproduct__MMColParam
getproduct__MMColParam = "1"
If (Request.QueryString("productid") <> "") Then
getproduct__MMColParam = FormatTextHTML(request.QueryString("productid"))
End If
%>
<%
Dim getproduct
Dim getproduct_numRows
Set getproduct = Server.CreateObject("ADODB.Recordset")
getproduct.ActiveConnection = MM_downloadtoday_STRING
getproduct.Source = "SELECT products.price, products.productID, products.Title, products.Characterid, products.NEW, products.BROADBAND, products.Graphic1, products.Graphic1url, products.Graphic2, products.Graphic2url, products.PCTry, products.PCBuy, products.FileSize, products.PCSystemReq, products.Age, products.MetaDescription, (select AVG(ratings.rating) FROM ratings where ratings.productid=products.productID group by productid) AS avgrating, products.Description2, products.BonusPoints From products WHERE productid = " + Replace(getproduct__MMColParam, "'", "''") + ""
getproduct.CursorType = 0
getproduct.CursorLocation = 2
getproduct.LockType = 1
getproduct.Open()
getproduct_numRows = 0
%>
<%
Dim RatingCheck__MMColParam
RatingCheck__MMColParam = Session.SessionID
Dim RatingCheck
Dim RatingCheck_numRows
Set RatingCheck = Server.CreateObject("ADODB.Recordset")
RatingCheck.ActiveConnection = MM_downloadtoday_STRING
RatingCheck.Source = "SELECT * FROM ratings WHERE session = '" + Replace(RatingCheck__MMColParam, "'", "''") + "' and productid = " + Replace(getproduct__MMColParam, "'", "''") + ""
RatingCheck.CursorType = 0
RatingCheck.CursorLocation = 2
RatingCheck.LockType = 1
RatingCheck.Open()
RatingCheck_numRows = 0
%>
<%
Dim CommentCheck__MMColParam
CommentCheck__MMColParam = Session.SessionID
Dim CommentCheck
Dim CommentCheck_numRows
Set CommentCheck = Server.CreateObject("ADODB.Recordset")
CommentCheck.ActiveConnection = MM_downloadtoday_STRING
CommentCheck.Source = "SELECT * FROM comments WHERE session = '" + Replace(CommentCheck__MMColParam, "'", "''") + "' and productid = " + Replace(getproduct__MMColParam, "'", "''") + ""
CommentCheck.CursorType = 0
CommentCheck.CursorLocation = 2
CommentCheck.LockType = 1
CommentCheck.Open()
CommentCheck_numRows = 0
%>
<%
' *** Edit Operations: declare variables
Dim ratedalready
Dim commentedalready
ratedalready = 0
commentedalready = 0
Dim profanitycount
Dim EmailError
Dim firstnameerror
firstnameerror = 0
EmailError = 0
Dim firstnameerror2
firstnameerror2 = 0
Dim profanityerror
profanityerror = 0
dim locationerror
locationerror = 0
dim firstnameentry
dim firstnameentry2
dim locationentry
dim emailenrty
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "ratingform") Then
If (Request.Form("rating") <> "") Then
MM_editConnection = MM_downloadtoday_STRING
MM_editTable = "ratings"
MM_editRedirectUrl = ""
MM_fieldsStr = "rating|value|session|value|productid|value"
MM_columnsStr = "rating|none,none,NULL|session|',none,''|productid|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
' *** Insert Record: construct a sql insert statement and execute it
If RatingCheck.EOF And RatingCheck.BOF Then
Dim MM_tableValues2
Dim MM_dbValues2
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues2 = ""
MM_dbValues2 = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues2 = MM_tableValues2 & ","
MM_dbValues2 = MM_dbValues2 & ","
End If
MM_tableValues2 = MM_tableValues2 & MM_columns(MM_i)
MM_dbValues2 = MM_dbValues2 & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues2 & ") values (" & MM_dbValues2 & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Dim getaverage__MMColParam
getaverage__MMColParam = "1"
If (Request.QueryString("productid") <> "") Then
getaverage__MMColParam = FormatTextHTML(request.QueryString("productid"))
End If
Dim getaverage
Dim getaverage_numRows
Set getaverage = Server.CreateObject("ADODB.Recordset")
getaverage.ActiveConnection = MM_downloadtoday_STRING
getaverage.Source = "SELECT AVG(rating) as avgrating FROM ratings WHERE productid = " + Replace(getaverage__MMColParam, "'", "''") + " group by productid"
getaverage.CursorType = 0
getaverage.CursorLocation = 2
getaverage.LockType = 1
getaverage.Open()
getaverage_numRows = 0
Dim setaverage__MMColParam
setaverage__MMColParam = FormatTextHTML(request.QueryString("productid"))
Dim setaverage__MMColParam2
setaverage__MMColParam2 = getaverage.Fields.Item("avgrating").Value
Set MM_editCmd2 = Server.CreateObject("ADODB.Command")
MM_editCmd2.ActiveConnection = MM_editConnection
MM_editCmd2.CommandText = "Update Products Set avgrating = " + Replace(setaverage__MMColParam2, "'", "''") + " Where productid = " + Replace(setaverage__MMColParam, "'", "''") + ""
MM_editCmd2.Execute
MM_editCmd2.ActiveConnection.Close
getaverage.Close()
Set getaverage = Nothing
End if
End if
End if
End if
locationentry = FormatTextHTML(request("location"))
If (CStr(Request("location")) = "") Then
locationerror =1
else
locationerror =0
end if
firstnameentry2 = FormatTextHTML(request("firstname"))
If (CStr(Request("firstname")) = "") Then
Firstnameerror2 =1
else
Firstnameerror2 =0
End if
If (Request.Form("firstname") <> "FU") Then
' Allow the advert to be processed
profanityerror = 0
Else
' Alert the user to try again
profanityerror = 1
End If
MM_editConnection = MM_downloadtoday_STRING
MM_editTable = "comments"
MM_editRedirectUrl = ""
MM_fieldsStr = "firstname|value|Location|value|comment|value|session|value|productid|value"
MM_columnsStr = "firstname|',none,''|location|',none,''|comment|',none,''|session|',none,''|productid|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If CommentCheck.EOF And CommentCheck.BOF Then
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
If (Request.Form("comment") <> "") Then
If Firstnameerror2 = 0 and profanityerror = 0 And locationerror = 0 Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
end if
End If
end if
End if
%>
<%
Dim getComments__MMColParam
getComments__MMColParam = "1"
If (Request.QueryString("productid") <> "") Then
getComments__MMColParam = FormatTextHTML(request.QueryString("productid"))
End If
%>
<%
Dim getComments
Dim getComments_numRows
Set getComments = Server.CreateObject("ADODB.Recordset")
getComments.ActiveConnection = MM_downloadtoday_STRING
getComments.Source = "SELECT * FROM comments WHERE productid = " + Replace(getComments__MMColParam, "'", "''") + " order by commentid desc"
getComments.CursorType = 0
getComments.CursorLocation = 2
getComments.LockType = 1
getComments.Open()
getComments_numRows = 0
%>
<%
Dim getrelatedtitles__MMColParam
getrelatedtitles__MMColParam = "1"
If (Request.QueryString("productid") <> "") Then
getrelatedtitles__MMColParam = FormatTextHTML(request.QueryString("productid"))
End If
%>
<%
Dim getrelatedtitles
Dim getrelatedtitles_numRows
Set getrelatedtitles = Server.CreateObject("ADODB.Recordset")
getrelatedtitles.ActiveConnection = MM_downloadtoday_STRING
getrelatedtitles.Source = "SELECT relatedtitles.productid, relatedtitles.relateid, products.title FROM relatedtitles, products WHERE relatedtitles.productid = " + Replace(getrelatedtitles__MMColParam, "'", "''") + " AND relatedtitles.relateid = products.productid"
getrelatedtitles.CursorType = 0
getrelatedtitles.CursorLocation = 2
getrelatedtitles.LockType = 1
getrelatedtitles.Open()
getrelatedtitles_numRows = 0
%>
<%
Dim getrelatedtext__MMColParam
getrelatedtext__MMColParam = "1"
If (Request.QueryString("productid") <> "") Then
getrelatedtext__MMColParam = FormatTextHTML(request.QueryString("productid"))
End If
%>
<%
Dim getrelatedtext
Dim getrelatedtext_numRows
Set getrelatedtext = Server.CreateObject("ADODB.Recordset")
getrelatedtext.ActiveConnection = MM_downloadtoday_STRING
getrelatedtext.Source = "SELECT * FROM relatedtext WHERE productid = " + Replace(getrelatedtext__MMColParam, "'", "''") + ""
getrelatedtext.CursorType = 0
getrelatedtext.CursorLocation = 2
getrelatedtext.LockType = 1
getrelatedtext.Open()
getrelatedtext_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 15
Repeat1__index = 0
getComments_numRows = getComments_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
getrelatedtitles_numRows = getrelatedtitles_numRows + Repeat2__numRows
%>
<%
Dim Repeat3__numRows
Dim Repeat3__index
Repeat3__numRows = -1
Repeat3__index = 0
getrelatedtext_numRows = getrelatedtext_numRows + Repeat3__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim getrelatedtitles_total
Dim getrelatedtitles_first
Dim getrelatedtitles_last
' set the record count
getrelatedtitles_total = getrelatedtitles.RecordCount
' set the number of rows displayed on this page
If (getrelatedtitles_numRows < 0) Then
getrelatedtitles_numRows = getrelatedtitles_total
Elseif (getrelatedtitles_numRows = 0) Then
getrelatedtitles_numRows = 1
End If
' set the first and last displayed record
getrelatedtitles_first = 1
getrelatedtitles_last = getrelatedtitles_first + getrelatedtitles_numRows - 1
' if we have the correct record count, check the other stats
If (getrelatedtitles_total <> -1) Then
If (getrelatedtitles_first > getrelatedtitles_total) Then
getrelatedtitles_first = getrelatedtitles_total
End If
If (getrelatedtitles_last > getrelatedtitles_total) Then
getrelatedtitles_last = getrelatedtitles_total
End If
If (getrelatedtitles_numRows > getrelatedtitles_total) Then
getrelatedtitles_numRows = getrelatedtitles_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (getrelatedtitles_total = -1) Then
' count the total records by iterating through the recordset
getrelatedtitles_total=0
While (Not getrelatedtitles.EOF)
getrelatedtitles_total = getrelatedtitles_total + 1
getrelatedtitles.MoveNext
Wend
' reset the cursor to the beginning
If (getrelatedtitles.CursorType > 0) Then
getrelatedtitles.MoveFirst
Else
getrelatedtitles.Requery
End If
' set the number of rows displayed on this page
If (getrelatedtitles_numRows < 0 Or getrelatedtitles_numRows > getrelatedtitles_total) Then
getrelatedtitles_numRows = getrelatedtitles_total
End If
' set the first and last displayed record
getrelatedtitles_first = 1
getrelatedtitles_last = getrelatedtitles_first + getrelatedtitles_numRows - 1
If (getrelatedtitles_first > getrelatedtitles_total) Then
getrelatedtitles_first = getrelatedtitles_total
End If
If (getrelatedtitles_last > getrelatedtitles_total) Then
getrelatedtitles_last = getrelatedtitles_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (profanitycheck_total = -1) Then
' count the total records by iterating through the recordset
profanitycheck_total=0
While (Not profanitycheck.EOF)
profanitycheck_total = profanitycheck_total + 1
profanitycheck.MoveNext
Wend
' reset the cursor to the beginning
If (profanitycheck.CursorType > 0) Then
profanitycheck.MoveFirst
Else
profanitycheck.Requery
End If
' set the number of rows displayed on this page
If (profanitycheck_numRows < 0 Or profanitycheck_numRows > profanitycheck_total) Then
profanitycheck_numRows = profanitycheck_total
End If
' set the first and last displayed record
profanitycheck_first = 1
profanitycheck_last = profanitycheck_first + profanitycheck_numRows - 1
If (profanitycheck_first > profanitycheck_total) Then
profanitycheck_first = profanitycheck_total
End If
If (profanitycheck_last > profanitycheck_total) Then
profanitycheck_last = profanitycheck_total
End If
End If
%>
Scholastic.com | The Scholastic Store: Digital Downloads
">
<%
doMenu
%>
With each digital download you purchase, you will receive a coupon via e-mail that will earn you 3X the download price in Bonus Points. So if you purchase a digital download for $14.95, you will get a coupon worth 45 Bonus Points!
Basic
Info: WINDOWS® ONLY
<%=(getproduct.Fields.Item("PCSystemReq").Value)%> *File Size: <%=(getproduct.Fields.Item("FileSize").Value)%>MB
<% If connectionspeed = "narrow" AND (getproduct.Fields.Item("BROADBAND").Value) = "Broad" Then %>
--
<% Else %>
Estimated download time:
<% IF connectionspeed = "broad" Then%> <%
downloadtime = cSng(getproduct.Fields.Item("FileSize").Value)
total=(((downloadtime) * 10485760) /1500000)
mi=int(total/60)
if mi < 1 Then
response.write "<1 min"
else
response.write mi & "min"
end if
%>
<% Else %>
<%
downloadtime = cSng(getproduct.Fields.Item("FileSize").Value)
total=(((downloadtime) * 10485760) /512000)
mi=int(total/60)
if mi < 1 Then
response.write "<1 min."
else
response.write mi & "min."
end if
%>
<% End If %>
<% End If %>
Note:
Actual download times may vary. DSL and Cable Modem speeds can range
between 256 Kbps and 1.5 Mbps depending on type of connection.
<%
doFooter
%>
<%
getproduct.Close()
Set getproduct = Nothing
%>
<%
RatingCheck.Close()
Set RatingCheck = Nothing
%>
<%
CommentCheck.Close()
Set RatingCheck = Nothing
%>
<%
getComments.Close()
Set getComments = Nothing
%>
<%
getrelatedtitles.Close()
Set getrelatedtitles = Nothing
%>
<%
getrelatedtext.Close()
Set getrelatedtext = Nothing
%>