How to Get Login time history in PHP?

Discussion in 'Programming' started by AimyThomas, Oct 4, 2012.

  1. #1
    Hi,

    Need a perfect user data base solution for my ecommerce website. I want to track whole activity of my end user until the user logout

    Thanks in Advance
     
    AimyThomas, Oct 4, 2012 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    you want to see the history of pages visited by the user that logged in? maby create a table that can hold visited pages and add a little script to each requested page to insert data into the database?

    b.t.w. what do you have tried?
     
    EricBruggema, Oct 4, 2012 IP
  3. kevinn13

    kevinn13 Greenhorn

    Messages:
    24
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    11
    #3
    A simple way would be to add this snippet to the top of each page first make this database in your SQL

    CREATE TABLE
    TRACKUSER
    (

    IPUser VARCHAR( 50 ),
    Time VARCHAR( 50 ),
    Date VARCHAR( 50 ),
    Page VARCHAR( 50 )
    ;


    Then add this to the top of your page

    <?php
    // Name Page
    $pagename="Home Page";
    // Then Save to Database
    // SQL CONNECTION
    $query="INSERT INTO TRACKUSER
    VALUES

    ("$ip", "$time", "$date", "$pagename");
    $result = mysql_query($query) or die ("Query cannot be added at this time.");

    ?>

    However this can slow page load speeds down.

    Regards
     
    kevinn13, Oct 5, 2012 IP
  4. albatrosl

    albatrosl Member

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    You want to registry every action? just the last one?
     
    albatrosl, Oct 5, 2012 IP