Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Counting Visitors??

    i've seen php codes in this forum to count the times that your site has been visited by saving it to a textfile... i tried it and it works... then again, i think to make it more organize, i save it to a database and add a field date and time just to identify the traffic in detail (actually, i've tried putting counters in all my pages (?? quite easy doing that way)... so, is it possible to record the ipaddress of your visitor just to identify the unique hits ? thanks.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sure it's possible. You can get the ip with
    PHP Code:
    if (isset ($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         
    $UserIP $_SERVER['HTTP_X_FORWARDED_FOR'];
    }else {
         
    $UserIP $_SERVER['REMOTE_ADDR'];

    But you do realise that your webserver logfiles contain all that info + that there are loads of tools to proces and analyses your logs ...
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, i know that... but the webserver is located in the other department... i just have link (a shared folder) to our site and my databases ... and they wanted me to count the site visitors on my own... anyway, thanks for your help raf!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •