Re: Styles on frontpage?

Thanks bobbit, it's worked now smile i also have included the else statement so it will only visible to the registered user.

if mONey is lOSt nOThINg is lOSt,
if cHArACtER is lOSt sOMeTHiNG is lOSt,
bUT,
if rELiGIon and eDUcATiON aRE lOSt eVErYThINg is lOSt.

27

Re: Styles on frontpage?

nice smile

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

28 (edited by Spinal 2005-10-05 16:25)

Re: Styles on frontpage?

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>