I have a techincal support form. And when the user hits submit i want to give
them a cookie. When they try to access this page again in a 24-48 hour time I
want the page to identify the cookie and redirect them to an alternative
page. Yet i am having a problem with the page.
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<%
Response.Expires = -1000 'Make sure the browser doesnt cache this page
Response.Buffer = True 'enables our response.redirect to work
dim show, verify
verify = "test"
show = Request.Cookies("workplz")
If verify = show
Then Response.Redirect "http://www.google.com"
End If
If Request.Form("valuepassed") ="true" Then
Mailform
Else
Techform
End If
Sub Mailform
'Dim queinfo, questr
Dim prod
prod = "test"
Response.Cookies("workplz")= prod
Response.Cookies("workplz").Expires = Date + 1
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Tech Form</title>"
HTML = HTML & "</head>"
HTML = HTML & "<center><b>Tech Form</b></center>"
HTML = HTML & "<br> <b>Name: </b>" & Request.Form("Name")
HTML = HTML & "<br> <b>Email: </b>" & Request.Form("Email")
HTML = HTML & "<br> <b>Operating System: </b>" & Request.Form("OS")
HTML = HTML & "<br> <b>Order Number: </b>" & Request.Form("Order")
HTML = HTML & "<br> <b>RAM: </b>" & Request.Form("RAM")
HTML = HTML & "<br> <b>Connection: </b>" & Request.Form("Connection")
HTML = HTML & "</body>"
HTML = HTML & "</html>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
All i know is the problem is located with the Cookie code (request or response), i am unsure which line as i am with IT as well trying to get it fixed so i can debug it.
OK, I think maybe you're refering to the expiration of the Cookie not being what you want it to be. This is the problem:
Response.Cookies("workplz").Expires = Date + 1
That will not give you a Cookie that expires one day from today. If it works, then it probably gives you a Cookie that expires one milli-second or one second from the current time.
Originally posted by phpnovice What error? You didn't mention anything previously about getting errors! I specifically asked you that question.
Show what you edited.
and i freakin answered it here: All i know is the problem is located with the Cookie code (request or response), i am unsure which line as i am with IT as well trying to get it fixed so i can debug it. All iget is an Internal Server Error.
I do not know WHERE the error is exactly at the moment until the techs fix the "friendly" error page on the server. All i know that it is with the Request.Cookies OR Response.Cookies. If i take both out the form works fine.
I have another problem now. I have another cookie that users will get when they get to our ecom. Hwo can i read this cookie on the form. I made the cookie on the ecom but i do not know how to access it on these forms since it is made on another domain.....
I found this but to be honest snippit online, I am at a loss here
Bookmarks