private static function get($type)
 {
     $ret = ClientData::session("messages_" . strtolower($type));
     unset($_SESSION["messages_" . strtolower($type)]);
     if ($ret === false) {
         $ret = array();
     }
     return $ret;
 }
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$categories = Category::selection(array('category_id:!=' => 0));
$products = Product::selection(array('category_id:!=' => 0));
$old_values = ClientData::session('_POST');
unset($_SESSION['_POST']);
?>
<script type="text/javascript">
<!--
function addLine() {
	var hidden=document.getElementById("template");
	var element = hidden.previousSibling;
	while(!String(element).match('HTMLTableRowElement')) {
		element = element.previousSibling;
	}
	var last_element_inputs = element.getElementsByTagName('input');
	for(i=0; i<last_element_inputs.length; i++) {
		if(last_element_inputs[i].value != '') {
			var new_line=hidden.cloneNode(true);
			new_line.removeAttribute('style');
			new_line.removeAttribute('id');
			hidden.parentNode.insertBefore(new_line, hidden);
			return;
		}
	}
}
var products = new Array();
<? foreach($products as $product): ?>
<?php

$post = ClientData::session('loggin_form');
?>
<h1>Logga in</h1>
<form action="/scripts/authenticate.php" method="post">
	<table>
		<tr>
			<th>Användarnamn<input type="hidden" name="kickback" value="<?php 
echo $post ? $post['kickback'] : ClientData::request('kickback');
?>
" /></th>
			<td><input type="text" name="username" id="initial_focus" <?php 
echo $post ? "value=\"{$post['username']}\"" : '';
?>
 /></td>
		</tr>
		<tr>
			<th>Lösenord</th>
			<td><input type="password" name="password" /></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit" value="Logga in" /></td>
		</tr>
	</table>
</form>