1

(27 replies, posted in PunBB 1.2 troubleshooting)

I try this "mod" but I've an error from the style.php :

Une erreur s'est produite
Erreur : Unable to update style.

How can i change this please ?

This is my style.php :

<?php

If (isset($_POST['style_sent']) && $_POST['style_sent'] == 1)
    {
    define('PUN_ROOT', './');
    include(PUN_ROOT.'include/common.php');
    $style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];
    echo '<link rel="stylesheet" type="text/css" href="'.$pun_root.'style/'.$style.'.css">';

    $id = $cur_user['id'];
    $db->query('UPDATE '.$db->prefix.'users SET    style=\''.addslashes($_POST['style']).'\' WHERE id='.$id) or error('Unable to update style', __FILE__, __LINE__, $db->error());
    redirect($pun_root.'hem.php', 'Sida redigerad, vänta...');
    }
?>

<tr>
    <td><br><b>Style</b>
        <form method="post" action="<?php echo $pun_root; ?>style.php"> 
            <input type="hidden" name="style_sent" value="1">
            <select name="style">
            <?php
            $d = dir($pun_root.'style');
            while (($entry = $d->read()) !== false)
                {
                if (substr($entry, strlen($entry)-4) == '.css')
                    $styles[] = substr($entry, 0, strlen($entry)-4);
                }
                $d->close();

            while (list(, $temp) = @each($styles))
                {
                if ($user['style'] == $temp)
                    echo "\t\t\t\t\t".'<option value="'.$temp.'" selected>'.str_replace('_', ' ', $temp).'</option>'."\n";
                else
                    echo "\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
                }    
            ?>
            </select>&nbsp&nbsp<input type="submit" value="Change">
        </form>
    </td>
</tr>