You are here

function _persistent_login_debug in Persistent Login 5

1 call to _persistent_login_debug()
persistent_login_block in ./persistent_login_debug.inc
Implementation of hook_block().

File

./persistent_login_debug.inc, line 22

Code

function _persistent_login_debug() {
  $output = '<div class="error">Security Hole!  Debugging only. ' . 'Turn this off!</div>';
  global $user;
  $now = time();
  $output .= '<p>Time: ' . format_date($now) . " ({$now})<br />" . 'Uid: ' . $user->uid . '</p>';
  $output .= '<p>Cookies<br />';
  foreach ($_COOKIE as $name => $value) {
    $output .= "{$name} = {$value}<br />";
  }
  list($uid, $series, $token) = explode(':', $_COOKIE[PERSISTENT_LOGIN_COOKIE]);
  $res = db_query('SELECT * FROM {persistent_login} pl ' . 'WHERE pl.uid=%d', $uid);
  $rows = array();
  while ($r = db_fetch_array($res)) {
    $row = array();
    $row[] = $r['uid'];
    $row[] = $r['series'];
    $row[] = $r['token'];
    $row[] = date('m/d H:i', $r['expires']);
    $rows[] = $row;
  }
  $output .= '<p>Stored data:<br />';
  $output .= theme('table', array(
    'uid',
    'series',
    'token',
    'expires',
  ), $rows);
  $vars = array(
    'check',
    'login',
    'reauth',
    'default_user',
    'welcomed',
  );
  foreach ($vars as $var) {
    $output .= "persistent_login_{$var}: " . serialize($_SESSION['persistent_login_' . $var]) . "<br />";
  }
  return $output;
}