Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Source code for an extremely basic session editor (yes, found a little time to actually work on one). </p> <pre><code>&lt;?php function listData (array $data, array $parents = array ()) { $output = ''; $parents = array_map ('htmlspecialchars', $parents); $fieldName = $parents? '[' . implode ('][', $parents) . ']': ''; foreach ($data as $key =&gt; $item) { $isArr = is_array ($item); $output .= $isArr? '&lt;li&gt;&lt;h4&gt;' . htmlspecialchars ($key) . '&lt;/h4&gt;': '&lt;li&gt;&lt;label&gt;' . htmlspecialchars ($key) . '&lt;/label&gt;: '; $output .= $isArr? '&lt;ul&gt;' . listData ($item, array_merge ($parents, array ($key))) . '&lt;/ul&gt;': '&lt;input type="text" name="fields' . $fieldName . '[' . htmlspecialchars ($key) . ']" value="' . htmlspecialchars ($item) . '" /&gt;'; $output .= "&lt;/li&gt;\n"; } return ($output); } session_start (); if ($_POST ['fields']) { $_SESSION = $_POST ['fields']; session_commit (); } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Session Editor&lt;/title&gt; &lt;style type="text/css"&gt; label { display: inline-block; min-width: 8em; text-align: right; padding-right: .3em; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;Session Editor&lt;/h2&gt; &lt;form action="&lt;?php echo ($_SERVER ['SCRIPT_NAME']); ?&gt;" method="post"&gt; &lt;ul&gt; &lt;?php echo (listData ($_SESSION)); ?&gt; &lt;/ul&gt; &lt;div&gt; &lt;input type="submit" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Obviously extremely simplistic, but it does at least allow me to edit arbitrary session data without having to write new code every time. Might work some more on this at some point to build it into a fully featured editor, but it will do for now. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload