Skip to content

Instantly share code, notes, and snippets.

@apermo
Created November 4, 2021 07:03
Show Gist options
  • Save apermo/085321241948cc6c0d95f03fc79a1b17 to your computer and use it in GitHub Desktop.
Save apermo/085321241948cc6c0d95f03fc79a1b17 to your computer and use it in GitHub Desktop.
Simple WordPress User Session debugger
<html>
<head>
<style type="text/css">
textarea {
width: 100%;
height: 300px;
}
td {
border: 2px dashed grey;
padding: 1em;
}
</style>
</head>
<body>
<form method="post">
<label>
Session Tokens
<textarea name="session_tokens"><?php echo $_POST['session_tokens']; ?></textarea>
</label>
<input type="submit" value="Make readable">
</form>
<pre>
<?php
if ( ! empty( $_POST['session_tokens'] ) ) {
$session_tokens = unserialize( $_POST['session_tokens'] );
if ( ! is_array( $session_tokens ) ) {
return;
}
?>
<table>
<thead>
<tr>
<th>Logged in</th>
<th>Expiration</th>
<th>User Agent</th>
<!-- <th>IP</th>-->
<!-- <th>Token</th>-->
<th>Notizen</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $session_tokens as $token => $data ) {
?>
<tr>
<td><?php echo date( DATE_RFC822, $data['login'] ); ?></td>
<td><?php echo date( DATE_RFC822, $data['expiration'] ); ?></td>
<td><?php
echo str_replace( ')', ')<br>', $data['ua'] );
?>
</td>
<!-- <td>--><?php //echo $data['ip']; ?><!--</td>-->
<!-- <td>--><?php //echo $token; ?><!--</td>-->
<td contenteditable="true"></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment