2 Replies Latest reply on Sep 4, 2006 7:51 AM by Stefan_K.

    cgi.remote_addr and cgi.remote_host and hit counter

    jasan3114
      Hi,
      I am a beginner. Borrowed and modified script for a counter as well as some statistics. Everything works fine except that the IP address of the visitor always shows as 216.251.42.XX . I've tried to have friends access the site from all over just to check if I get a different IP address but its still 216.251.42.XX

      I wonder if someone can advise me on where I am going wrong.
      Thank you in advance.
      THE CF SYNTAX BEING USED BY ME is AS FOLLOWS:
      <cfquery name="updateHits" datasource="#RequestDSN#">
      UPDATE hit_counter SET hit_count = hit_count + 1
      </cfquery>
      <CFIF isdefined("Cookie.user_id")>
      <CFSET user_id=trim(Cookie.user_id)>
      <CFELSE>
      <CFSET user_id="">
      </CFIF>
      <cfset currentdate = #DateFormat(Now(), "dd mmm yy")#>
      <cfset currenttime = #TimeFormat(Now(), "hh:mm:ss")#>
      <CFSET address = cgi.remote_addr>
      <CFSET host = cgi.remote_host>
      <CFSET referer = cgi.http_referer>
      <CFSET agent = cgi.http_user_agent>
      <CFSET page = cgi.script_name>
      <CFIF NOT Len(host)>
      <CFSET host = "unknown">
      </CFIF>
      <CFIF NOT LEN(referer)>
      <CFSET referer = "unknown">
      </CFIF>
      <cfquery name="userstats" datasource="#RequestDSN#">
      INSERT INTO stats (VISITDATE, VISITTIME, ADDRESS, HOST, REFERER, AGENT, PAGE)
      VALUES ('#currentdate#', '#currenttime#', '#address#', '#host#', '#referer#', '#agent#', '#page#')
      </cfquery>