 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 5th, 2008, 07:55 PM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Remove URL from message
Hey guys,
I have a page that holds an enquiry form within my share accommodation website, and whilst Im using a CAPTCHA system already to prevent spam, I would like to remove any web addresses that may be posted in the actual message of the enquiry as a way to further prevent unwanted rubbish being sent to my members.
Such as ...
"Advertise on my website instead - www.share-house.com.au"
Is there a way to identify a web address and REMOVE it from the message before its emailed?
John
www.webdesigndocuments.com
__________________
Works Media - Online Marketing & SEO
|
|

August 5th, 2008, 08:05 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Hello fellow Aussie...
IMO web addresses shouldnt be 'farmed' and spam shouldnt be an issue from them. The email farmers would after all have to guess the chars before the @.....
Anyhow - string manipulation would be one way to skin your cat. EG You could look for 'www' get all the chars to the left and right until you find white space either end and use the replace function. Of course this assumes the web address contains www. As im sure you are aware there is every chance it may not.
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

August 5th, 2008, 08:10 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Sorry to go off topic - I have a freind who is looking for a share place. After looking at your website I cant figure out how to browse by suburb. The browse by suburb links arnt suburbs. If I click into Sydney (which seems to be a suburb link) I can seem to filter any further. Am I missing something?
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

August 5th, 2008, 08:16 PM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Gday mate! ;)
IMO web addresses shouldnt be 'farmed' and spam shouldnt be an issue from them
I disagree. What stops me from visiting a competitors site and spamming their members in order to have them advertise on my site, by simply entering my URL?
Also, and Ive seen it countless times before - "buy viagra - click here www.bestspamviagrapills.com"
I want to get rid of those URLS or remove them from the message body if possible....
The email farmers would after all have to guess the chars before the @.....
Not sure what you mean by this? Although I guess I may have to address potential email addresses being submitted within the body too.
I dont think looking for just "www" would be the best idea also incase they enter "gohere.com"
Bill you around mate?
John
www.webdesigndocuments.com
|
|

August 5th, 2008, 08:18 PM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
After looking at your website I cant figure out how to browse by suburb.
Im assuming you clicked on that www.share-house.com.au link which isnt my site.
I just posted that purely for example - little did I know a website actually existed there!
John
www.webdesigndocuments.com
|
|

August 5th, 2008, 08:33 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
lol... yes i did click on that link.
Anyhow back on topic:
;;;What stops me from visiting a competitors site and spamming their members in order to have them advertise on my site, by simply entering my URL?
Nothing - If you let people post without vetting content you open yourself up for this type of thing. IME there is no classic ASP code or function for checking if a URL is contained in a string. String manipulation is the tack I would take. BTW I wouldnt call that spamming
Additionaly - Of course just looking for 'www' is not the solution as I already suggested. This was a suggestion where to start
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

August 5th, 2008, 09:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Regular expressions, of course.
How thorough do you want to be??
Your example of
gohere.com
You want to prevent *anything* that has a common web url extension??? That's not too hard. You *might* accidentally zap a few things you didn't mean to, because people omitted a space, but w.t.h.
Let's see...off the top of my head:
Code:
<%
text = "sample with http://www.fullurl.org/subdir/buy.php and then just goHere.com."
Set re = New RegExp
re.Pattern = "\W[\w\/\:\-\\\.]{5,999}?\.(com|net|edu|org|co\.uk|info)[\w\.\-\/\\]*\W"
re.IgnoreCase = True
re.Global = True
zapped = re.Replace( text, "" )
Response.Write zapped
%>
Okay, now I'll go test it and report back.
|
|

August 5th, 2008, 10:01 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Pretty close!
The problem with it is that it zaps spaces and so runs the words together. Try it as is, to see what I mean.
Now, I dunno if that's such a big deal. If somebody is trying to spam you and their message ends up looking like crap, what do you care?
But what the heck.
It's an easy fix.
Code:
<%
text = "sample with http://www.fullurl.org/subdir/buy.php and then just goHere.com."
Set re = New RegExp
re.Pattern = "(\W)[\w\/\:\-\\\.]{5,999}?\.(com|net|edu|org|co\.uk|info)[\w\.\-\/\\]*(\W)"
re.IgnoreCase = True
re.Global = True
zapped = re.Replace( text, "$1$3" )
Response.Write zapped
%>
You should, of course, combine this RegExp with one that zaps all HTML tags (up to you if you allow a handful of things like <B> and <P>, etc.).
*****************
p.s.: If not obvious, you just add in all the extensions you want to be sure of into that list with the parens around it:
(com|net|edu|org|co\.uk|info)
|
|

August 5th, 2008, 10:27 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Very slick Old Pendant...
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

August 6th, 2008, 02:50 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Looks good Bill.
One last question...
Is there a way of looking to see if the value has been trimmed and if so DONT send the email enquiry?
guest_enquiry = Trim(request.form("guest_enquiry"))
Set re = New RegExp
re.Pattern = "(\W)[\w\/\:\-\\\.]{5,999}?\.(com|net|edu|org|co\.uk|info|.au)[\w\.\-\/\\]*(\W)"
re.IgnoreCase = True
re.Global = True
zapped = re.Replace( guest_enquiry, "$1$3" )
if zapped is OK send mail
else - DO NOTHING
end if
Response.Write zapped
ped·ant (p#277;d'nt)
n.
One who pays undue attention to book learning and formal rules.
One who exhibits one's learning or scholarship ostentatiously.
Obsolete. A schoolmaster.
www.webdesigndocuments.com
|
|
 |