Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two strings with wildcards (LIKE?)

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi Everybody

This is driving me crazy because I know how to do it, but can't get it right. I want to check where the user came from, and am using request.servervariables("HTTP_REFERER") to see. I'm trying to build an if statement that compares it to where they "should have" come from, and then perform different actions based on their origin. The problem is, I don't want to hard code the whole URL in there in order to avoid problems when we switch between servers (development to production, etc...). So I'm trying to say something like

Code:
IF request.servervariables("HTTP_REFERER") LIKE filename.asp THEN

I know that LIKE is SQL, so I've tried wild cards (% and *), and can't get it to work. HELP!!!!!

Ben
 
Change the Instr to add start of 1.
Maybe?
strReferer = Trim(request.servervariables("http_REFERER"))
' Case Insensitive Compare
if Len(strReferer) > 0 and _
0 < Instr(1,strReferer,strLikeFileName,1) THEN
Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top