|
INCLUDE FILE SYNTAX <!--#include file="test.inc"--> CURRENT URL'S FILENAME Request.ServerVariables("URL")
SENDING EMAILS Send <% Set MailObject = Server.CreateObject("CDONTS.NewMail") MailObject.From = "from@me.com" MailObject.To = "to@me.com" MailObject.Subject = "Subject Text Here" MailObject.Body = "Body Text Here" MailObject.Send Set MailObject = Nothing %> Sending an Attachment <% Set MailObject = Server.CreateObject("CDONTS.NewMail") attFile = "c:\attachments\StandardPolicy.txt" attName = "Policy.txt" MailObject.From = "from@me.com" MailObject.To = "to@me.com" MailObject.Subject = "Subject Text Here" MailObject.Body = "Body Text Here" MailObject.AttachFile attFile, attName MailObject.Send Set MailObject = Nothing %> simplest mail format0 set objMail = createobject("CDONTS.NewMail") objMail.send "from@here.com", "felarca@earthlink.net", "Subject Line", "Message Body" set objMail = nothing STRIP ILLEGAL CHARACTERS FROM USER INPUT http://www.4guysfromrolla.com/webtech/112702-1.shtml: uses regex to accept only alphanumerics 'Create a regular expression object Dim regEx Set regEx = New RegExp 'The global property tells the RegExp engine to find ALL matching 'substrings, instead of just the first instance. We need this to be true. regEx.Global = true 'Our pattern tells us what to find in the string... In this case, we find 'anything that isn't a numerical character, or a lowercase or 'uppercase alphabetic character regEx.Pattern = "[^0-9a-zA-Z]" 'Use the replace function of RegExp to clean the username. The replace 'function takes the string to search (using the Pattern above as the 'search criteria), and the string to replace any found strings with. 'In this case, we want to replace our matches with nothing (''), 'as the matching characters will be the ones we don't want in our username. dim username username = regEx.Replace(request.form("UserName"), "") REQUEST.FORM() works with forms that are POSTed, not GET'ed; GET forms would use request.querystring
to iterate thru elements in a form:
for i = 1 to request.form().count
response.write request.form()(i)
next
SERVER.HTMLENCODE() converts string into html-friendly output; keeps output from being interpreted as html code * Must be used to encode input parameters when outputting to page!!! URLENCODE() again, use to format user-input-based url's for safety (?) STRING OPERATIONS len() - length GET PHYSICAL PATH server.mappath ...xxx REDIRECT, THE RIGHT WAY http://www.stevenhargrove.com/redirect-web-pages/ <% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "http://www.new-url.com/" %> |
|
Page last modified on April 29, 2008, at 09:30 PM
|
|