protomatteruk
Technical User
Hi All,
I am pretty much a novice when it comes to VBScript and this is now officially driving me mad. When I upload the following code in an asp page to my web-server it just displays HTTP 500 error. It works locally on IIS and win2k. 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.
I am pretty much a novice when it comes to VBScript and this is now officially driving me mad. When I upload the following code in an asp page to my web-server it just displays HTTP 500 error. It works locally on IIS and win2k. 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.
Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
dim numberSent
dim maxperday
maxperday = 10
function sendSMS()
Set CDOMail = Server.CreateObject("CDONTS.NewMail")
CDOMail.From = "sms@whatever.co.uk"
CDOMail.To = "me@sms.me.co.uk"
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
%>