View Single Post
  #4 (permalink)  
Old Oct 30th, 2007, 05:14
Monie Monie is offline
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: My Page Statistic [Browser & OS]

Hai everyone,

I've come up with this simple code (but I ended up doing it for the whole day tho..)

It basically capture the user info like the type of browser they are using, their server software and the most important thing is their IP address, and store them in the database.

HTML: Select all
<%
Dim ipadd, browser, serversw
ipadd = Request.ServerVariables("remote_addr")
browser = Request.ServerVariables("http_user_agent")
serversw = Request.ServerVariables("server_software")
%>
HTML: Select all
<%    
    Do while not pg.EOF
        If pg("ipaddress") = ipadd Then 'If the user IP address appear to be exist in the database already, just redirect them to the main page!
            pg.Close
            pgConn.Close
            set pg=nothing
            set pgConn=nothing
            Response.Redirect("default.asp")
        End If  
    pg.MoveNext
    Loop

    'If the user IP address don't exist in the database, save them to the database..!
    Set pg = pgConn.Execute("INSERT INTO pagerank (ipaddress, browser, serversoftware) VALUES ('" & ipadd & "', '" & browser & "', '" & serversw & "')")
    Response.Redirect("default.asp")
%>
Now I can do my page rank statistic...
If there is any better way, please share, Thanks..

Last edited by Monie; Nov 1st, 2007 at 07:19.
Reply With Quote