Location: PHPKode > scripts > WebsiteMemberManager > members-section/admin/php/login-records.php
<?php
include("login-records.html");
if (!isset($startq)) $startq=0;
if (!isset($endq)) $endq=3;

if (!isset($limit_var)) $limit_var=0;
else $limit_var++;
$next_link = "<a href=\"javascript:action('login-records.php','0','',$limit_var,'')\">Older login records</a>";
$limit_var_A=$limit_var -1;

$to_day = mktime (0,0,0,date("m"), date("d")-$limit_var_A, date("Y"));
$prev_day = mktime (0,0,0,date("m"), date("d")-$limit_var, date("Y"));

if ($limit_var_A!=0) $to_day = mktime (0,0,0,date("m"), date("d")-$limit_var_A, date("Y"));
else $to_day = time();

if ($id>0)
{
  $l_query="SELECT * FROM wmm_logins where member_id='$id' ORDER BY login_date DESC LIMIT 50";
  echo "<b><center>Displaying upto 50 of the last logins for a single member </center></b>";
}
else
{
  $l_query="SELECT * FROM wmm_logins where login_date>=$prev_day AND login_date<=$to_day ORDER BY login_date DESC LIMIT 50";
  echo "<b><center>Displaying logins for a 24 hours duration from $limit_var_A day(s) ago. $next_link</center></b>";
}
$dbc = dbc::instance();
$result = $dbc->prepare($l_query);
$rows = $dbc->executeGetRows($result);
if (count($rows)>0)  // check has got some
{
 $i = 0;
 while ($i< count($rows))
 {
  $login_date=$rows[$i]['login_date'];
  $member_id=$rows[$i]['member_id'];
  $ip_no=$rows[$i]['ip_no'];
  $user_agent=$rows[$i]['user_agent'];
  $result = $dbc->prepare("SELECT * FROM wmm_members where id='$member_id'");
  $rows2 = $dbc->executeGetRows($result);
  if (count($rows2)>0)  // check has got some
  {
   $name=$rows2[0]['name'];
   $companyname=$rows2[0]['companyname'];
   $postcode=$rows2[0]['postcode'];
   $postcode=trim($postcode);
  }
  else
  {
   $name="a/c removed";
   $companyname="";
   $postcode="";
  }
  $time_str = strftime("%X on %d %b %Y",$login_date);
  echo "$time_str";
  echo ". &nbsp;<a href=\"javascript:action('view.php','$member_id','','','modify')\">$name - VIEW Details</a>";
  echo ". &nbsp;<b>IP No:</b> $ip_no - <b>User Agent:</b> $user_agent<br><br>";
  $i++;
 } // end while

 if (!isset($the_action)) echo "<br><center>$next_link</center>";
}
else echo "<br><br><hr width=50%><center><h3>NO login records for this period.</h3><hr width=50%><br><br><br>";
?>
</div>
</div>
</div>
Return current item: WebsiteMemberManager