PHP Login System with Admin Features

Would you like to react to this message? Create an account in a few clicks or log in to continue.
PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


2 posters

    How do you interpret "Last Active" in Admin

    dkhoskins
    dkhoskins


    Number of posts : 1
    Registration date : 2013-05-24

    How do you interpret "Last Active" in Admin Empty How do you interpret "Last Active" in Admin

    Post  dkhoskins Fri May 24, 2013 11:29 am

    When I log into the admin panel I see a list of all "Registered Members" and one column has last active.

    I know this number increases everytime a member logs in, but is there a way to interpret it. Does it represent the date and time for instance. As an example,

    This is my Last Active:

    1369408196 (When I logged in on 5/24/2013 at 11:10am EST)

    Logged out then logged back in and my number was this.

    1369408310 (5/24/2013 at 11:11am EST)

    Any help would be appreciated.
    jbonnett
    jbonnett


    Number of posts : 2
    Age : 31
    Registration date : 2012-12-10

    How do you interpret "Last Active" in Admin Empty Re: How do you interpret "Last Active" in Admin

    Post  jbonnett Mon Jun 17, 2013 1:26 am

    Add this at the very bottom of "include/session.php"
    Code:
    function Agotime($date)
    {
        if(empty($date)) {
            return "No date provided";
        }
     
        $periods        = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
        $lengths        = array("60","60","24","7","4.35","12","10");
     
        $now            = time();
        $unix_date        = strtotime($date);
     
          // check validity of date
        if(empty($unix_date)) {   
            return "Bad date";
        }
     
        // is it future date or past date
        if($now > $unix_date) {   
            $difference    = $now - $unix_date;
            $tense        = "ago";
     
        } else {
            $difference    = $unix_date - $now;
            $tense        = "from now";
        }
     
        for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
            $difference /= $lengths[$j];
        }
     
        $difference = round($difference);
     
        if($difference != 1) {
            $periods[$j].= "s";
        }
     
        return "$difference $periods[$j] {$tense}";
    }    



    And add this to user info
    Code:
    /* Last active */
    $today = getdate($req_user_info['timestamp']);
    $ax = $today['month'] . " " . $today['mday'] . ", " . $today['year'];
    $ax .= " " . $today['hours'] . ":" . $today['minutes'] . ":" . $today['seconds'];

    echo "<tr><td><b>Last Active:</b> </td><td>".Agotime($ax)."</td></tr>";

      Current date/time is Fri May 17, 2024 5:27 am