Link to home
Start Free TrialLog in
Avatar of lulu50
lulu50Flag for United States of America

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.GetIPUser")>
  <cflocation url="home.html?ChID=#listlast(cookie.GetIPUser)#">
<cfelse>
      <CFIF #CGI.HTTP_X_Forwarded_For# EQ "">
            <CFSET ipaddress="#CGI.Remote_Addr#">
      <CFELSE>
            <CFSET ipaddress="#CGI.HTTP_X_Forwarded_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=#GetIPADD.ChurchID#">
  <cfelse>
    <cfcookie name="GetIPUser" value="#ipaddress#" expires="30">
  </cfif>

</cfif>
ASKER CERTIFIED SOLUTION
Avatar of cfEngineers
cfEngineers

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cfEngineers
cfEngineers

also if you are using www or not using www makes a difference when you try it again.
Avatar of lulu50

ASKER

yes, I understand thank you cfEngineers:
Avatar of lulu50

ASKER

Thank you
any time