lulu50
asked on
Refresh page on page load
Hi,
I am not sure why my code are not read when the user visit my page but if I refresh the page
I can see that it is going thru the code.
HHHmmmm
for example I said if the cookie exist then go to the home page. but for some reason it will only go to the home page if I refresh the page. the cookie is there so it should automatically go to the home page.
<cfif IsDefined("cookie.GetIPUse r")>
<cflocation url="home.html?ChID=#listl ast(cookie .GetIPUser )#">
<cfelse>
<CFIF #CGI.HTTP_X_Forwarded_For# EQ "">
<CFSET ipaddress="#CGI.Remote_Add r#">
<CFELSE>
<CFSET ipaddress="#CGI.HTTP_X_For warded_For #">
</CFIF>
<CFQUERY DATASOURCE="xxx" NAME="GetIPADD">
Select distinct IPAddress, ChurchID FROM xx where IPAddress = '#ipaddress#'
</CFQUERY>
<cfif GetIPADD.RecordCount neq 0>
<cflocation url="home.html?ChID=#GetIP ADD.Church ID#">
<cfelse>
<cfcookie name="GetIPUser" value="#ipaddress#" expires="30">
</cfif>
</cfif>
I am not sure why my code are not read when the user visit my page but if I refresh the page
I can see that it is going thru the code.
HHHmmmm
for example I said if the cookie exist then go to the home page. but for some reason it will only go to the home page if I refresh the page. the cookie is there so it should automatically go to the home page.
<cfif IsDefined("cookie.GetIPUse
<cflocation url="home.html?ChID=#listl
<cfelse>
<CFIF #CGI.HTTP_X_Forwarded_For#
<CFSET ipaddress="#CGI.Remote_Add
<CFELSE>
<CFSET ipaddress="#CGI.HTTP_X_For
</CFIF>
<CFQUERY DATASOURCE="xxx" NAME="GetIPADD">
Select distinct IPAddress, ChurchID FROM xx where IPAddress = '#ipaddress#'
</CFQUERY>
<cfif GetIPADD.RecordCount neq 0>
<cflocation url="home.html?ChID=#GetIP
<cfelse>
<cfcookie name="GetIPUser" value="#ipaddress#" expires="30">
</cfif>
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also if you are using www or not using www makes a difference when you try it again.
ASKER
yes, I understand thank you cfEngineers:
ASKER
Thank you
any time