Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    2

    Unanswered: tracking logged in users

    I would like to keep track of who is logging in (cookie) and what pages they go to, what files they download would be an added bonus. (php/MySQL)

    I don't understand the code for how to insert the information into a database table.

    My tracking database table (userData) has the following fields: userID, pageVisited, filesDownloaded

    the pages these people will be using already has accessLevel code on each page:

    <?php
    if(!isset($HTTP_COOKIE_VARS['levelCookie'])){
    header("Location: secure.php");
    } else {
    if($HTTP_COOKIE_VARS['levelCookie'] < 2){
    header("Location: secure.php");
    }
    }
    ?>

    can someone help me with an example of how the code would work for inserting this data into a table?

    thanks!!

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    This can be simply done like this

    check for ur access level then execute the sql statemtn like this
    $sql="insert into userdata values('$username','$page_name','$timestamp')";
    so your table userdata should have these three filelds.
    You can che at what time did the user used which page.. OK?
    then connect to mysql

    mysql_connect('$host'','$UserID','$password');
    mysql_select_db('$db_name');
    $result=mysql_query($sql) or die (mysql_error()); //mysql_error() will give you the error from mysql if any erroe occcurs


    I think you got the idea how to insrt the information to the table
    If thisis not youwant then little more explaination is required in this regard

    Regards
    Rajesh

Posting Permissions

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