Ejemplo n.º 1
0
 public function updateLastAccess()
 {
     if ($this->isAuth()) {
         $customer = new Customer($this->db);
         $customer->data['customer_id'] = $this->customer->val('customer_id');
         $customer->data['customer_last_access'] = SqlQuery::mysqlTimestamp(time());
         $customer->save();
     }
 }
Ejemplo n.º 2
0
<?php

require_once $home_dir . 'models/customer.m.php';
require_once $home_dir . 'models/custsess.m.php';
$sessions = CustomerSession::Select($db, 'customer_sessions', 'customer_session_expires <= ?', [SqlQuery::mysqlTimestamp(time())], 's', null, null);
foreach ($sessions as $session) {
    $customer = new Customer($db, $session->val('customer_session_customer_id'));
    $session->deleteById();
    if ($customer->val('customer_anonymous')) {
        $customer->deleteById();
    }
}
echo 'Sessions cleared.';