erikTsomik
asked on
ListFindNoCase Question
I need to do the search for the domain name. So user may store in the database
http://test.com or test.com or www.test.com I need to find the domain.
So if the site domain is not equals to whatever they entered in the database set varible.
I have a piece of code that partially work . if they enter the the name without http it is working ,otherwise does not.
I need to allow the user to do it regardlesss
accessOK = 1;
if (ListFindNoCase(#cgi.serve r_name#,#d b.homeDoma in#) == 0) {
AccessOK = 0;
}
http://test.com or test.com or www.test.com I need to find the domain.
So if the site domain is not equals to whatever they entered in the database set varible.
I have a piece of code that partially work . if they enter the the name without http it is working ,otherwise does not.
I need to allow the user to do it regardlesss
accessOK = 1;
if (ListFindNoCase(#cgi.serve
AccessOK = 0;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops. typo correction, this line:
if (cgi.server_name eq dbDomain) == 0) {
should just be:
if (cgi.server_name eq dbDomain) {
if (cgi.server_name eq dbDomain) == 0) {
should just be:
if (cgi.server_name eq dbDomain) {
ie
<cfset dbDomain = getToken(db.homeDomain, 2, "//")>
If you're not validating the user entry, you'll need to scrub the data further. For example if you needed to remove the www:
<cfset dbDomain = listRest(dbDomain, ".")>
But there are some gotchas with using cgi.server_name. For example, the user could enter an IP instead of a name or this one
http://www.coldfusionjedi.com/index.cfm/2008/6/5/Use-cgiservername-Be-careful