
Cookie code now works offline but displays HTTP 500 online
Hi again,
Sorry for re-posting so soon, but this is now officially driving me mad. I
have reworked the code somewhat, and it now works for me offline on IIS.
When I upload it to my web-server however it just displays HTTP 500 error. I
think it has something to do with the CInt function and data type
mismatches, but am unsure. If anyone can point me in the right direction I
would be v. grateful, or let me know where I can find samples of this kind
of coding.
The basic idea is that if the cookie doesn't exist one is set with a count
of 1 and the sendSMS() function is called. If a cookie does exist then check
to see if its value is less than maxperday. If it is call the sendSMS()
function and increment the count by one. If it is equal or greater than
maxperday, then don't send.
That's what I know I want in my head, but getting it to work here is proving
more difficult than I imagined.
Any help greatly appreciated,
Colin Mc Mahon.
<%
dim numberSent
dim maxperday
maxperday = 10
function sendSMS()
Set CDOMail = Server.CreateObject("CDONTS.NewMail")
CDOMail.Subject = Request.Form("name")
CDOMail.Body = Request.Form("msg")
CDOMail.Send
Set CDOMail = nothing
End Function
If Len (Request.Cookies("sentmessages")) <> 0 Then
numberSent= CInt(Request.Cookies("sentmessages"))
If numberSent <= maxperday then
Response.Cookies("sentmessages") = Request.Cookies("sentmessages") + 1
sendSMS()
%>
<!--#include file="sent.asp" -->
<%
else
%>
<!--#include file="overQuota.asp" -->
<%
End if
else
Response.Cookies("sentmessages") = 1
Response.Cookies("sentmessagers").Expires = Date + 1
sendSMS()
%>
<!--#include file="sent.asp" -->
<%
End If
%>