I don't know if it could help you, but there is exactly what you want with a block of puntal
Puntal use punBB and all the styles of punBB, so i suggest you to have a look at it
Here is the code of the index.php for example :
<?php
/***********************************************************************
Copyright (C) 2005 Vincent Garnier (vin100@forx.fr)
This file is part of Puntal.
Puntal is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// if we want to switch style
if (isset($_POST['change_style']) && !$pun_user['is_guest'])
{
$db->query('UPDATE '.$db->prefix.'users SET style=\''.$_POST['styles'].'\' WHERE id='.$pun_user['id']) or error('Impossible de mettre à jour le profil', __FILE__, __LINE__, $db->error());
fct::redirect($_SERVER['REQUEST_URI'], $lang_puntal['Style redirect']);
}
if (!$pun_user['is_guest'])
{
$pt_styles = array();
$d = dir(PUN_ROOT.'style');
while (($entry = $d->read()) !== false)
{
if (substr($entry, strlen($entry)-4) == '.css')
$pt_styles[] = substr($entry, 0, strlen($entry)-4);
}
$d->close();
if (count($pt_styles) > 1)
{
natsort($pt_styles);
?>
<div class="block" id="styleSwitcherBox">
<h2><span><?php echo $lang_puntal_bloc_style_switcher['style_switcher']; ?></span></h2>
<div class="box">
<div class="inbox">
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<div class="inform">
<input type="hidden" name="change_style" value="1" />
<label for="styles"><?php echo $lang_puntal_bloc_style_switcher['choose_style']; ?></label><br />
<select id="styles" name="styles">
<?php
while (list(, $temp) = @each($pt_styles))
{
if ($GLOBALS['pun_user']['style'] == $temp)
echo "\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
else
echo "\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
}
?>
</select>
<input name="submit" value="<?php echo $lang_puntal_bloc_style_switcher['change']; ?>" type="submit" />
</div>
</form>
</div>
</div>
</div>
<?php
}
}
Hope it will help you