Location: PHPKode > projects > top serious project > bco/options.php
<?php

/***************************************************************************
 *
 *   This program 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.
 *
 ***************************************************************************/

include("include.php");

if (!$logged_in) {
    //redirect("login.php?back=options.php");
    header("Location: $GLOBALS[base_url]" . "login.php?back=options.php");
} 

if ($_POST['submit'] == "update options") {
    $query = "update users set images='$_POST[images]', hidden='$_POST[hidden]', show_stylesheet='$_POST[show_stylesheet]' where id=$user_array[myuserid]";
    if (!pg_query($query)) {
        bco_error("MySQL said: " . pg_last_error());
    }
    $array = array("username" => "$user_array[username]",
                   "password" => "$user_array[password]");
    bco_login($array);

    header("Location: $GLOBALS[base_url]");
    exit;
}

bco_html_header("Account options for $user_array[username].");

bco_index_menu("Account options for $user_array[username].");

if ($user_data['images'] == "1") {
    $checked_0 = "checked=\"checked\"";
} else {
    $checked_1 = "checked=\"checked\"";
}

if ($user_data['hidden'] == "0") {
    $checked_2 = "checked=\"checked\"";
} else {
    $checked_3 = "checked=\"checked\"";
}

if ($user_data['show_stylesheet'] == "1") {
    $checked_4 = "checked=\"checked\"";
} else {
    $checked_5 = "checked=\"checked\"";
}

echo <<< END
\n<br />
<form method="post" action="$PHP_SELF">
<table width="100%" cellpadding="2" cellspacing="0" class="replytable">
    <tr>
        <td colspan="2"><strong>Current values are selected.</strong></td>
    </tr>
    <tr>
        <td width="200" valign="top">Display images in threads:</td>
        <td>
            <input type="radio" name="images" value="1" $checked_0 /> Do display images.<br />
            <input type="radio" name="images" value="0" $checked_1 /> Do not display images.
        </td>
    </tr>
    <tr>
        <td width="200" valign="top">Hide me on the active list:</td>
        <td>
            <input type="radio" name="hidden" value="0" $checked_2 /> Do allow me to be listed on the active list.<br />
            <input type="radio" name="hidden" value="1" $checked_3 /> Do not allow me to be listed on the active list.
        </td>
    </tr>
    <tr>
        <td width="200" valign="top">Use stylesheet. (Turning this off will make page loading faster, in theory)</td>
        <td>
            <input type="radio" name="show_stylesheet" value="1" $checked_4 /> Do use stylesheet..<br />
            <input type="radio" name="show_stylesheet" value="0" $checked_5 /> Do not use stylesheet.
        </td>
    </tr>
    <tr>
        <td width="200">&nbsp;</td>
        <td>
            <input type="submit" name="submit" value="update options" class="button" />
        </td>
    </tr>
</table>
</form>
END;

bco_html_footer();

?>
Return current item: top serious project