Example #1
0
function main()
{
    if (check_post_values()) {
        header('Location: index.php');
    }
    create_html_start();
    echo '<div id="edit_catalogues">';
    create_catalogue_edit_form();
    echo '</div>';
    echo '<div id="main_links">';
    echo '<a href="index.php">List catalogues</a>';
    echo '<a href="logout.php">Logout</a>';
    echo '</div>';
    create_html_end();
}
Example #2
0
function main()
{
    create_html_start();
    echo '<div id="settings">';
    $ret = check_post_values();
    if ($ret == 0) {
        echo 'Password changed!';
    } else {
        if ($ret == 1) {
            echo 'Passwords did not match!';
        }
    }
    create_settings_page();
    create_html_end();
}
Example #3
0
function main()
{
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    } else {
        $day = date('Y-m-d');
    }
    check_post_values();
    create_html_start();
    show_error_msg();
    create_edit_form($day);
    create_html_end();
}
Example #4
0
function main()
{
    // Set day to show
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    } else {
        $day = date('Y-m-d');
    }
    create_html_start();
    // Check if there is POST-data
    check_post_values();
    // Show login or user own page
    if (user_logged()) {
        show_own_page($day);
    } else {
        show_login();
    }
    create_html_end();
}
Example #5
0
    echo '<table>';
    echo '<tr><td>Käyttäjätunnus</td>';
    echo '<td><input type="text" name="username"></td></tr>';
    echo '<tr><td>Salasana</td>';
    echo '<td><input type="password" name="password"></td></tr>';
    echo '<tr><td colspan="2"><input type="submit" ' . 'value="Kirjaudu"></td>';
    echo '</tr>';
    echo '</table>';
    echo '</form>';
    echo '<a href="register.php">Luo uusi käyttäjätunnus</a><br><br>';
    echo '</div>';
}
session_start();
require 'general_functions.php';
// Check POST-values if there is any.
check_post_values($db, $_POST);
// Create html start tags and top menu
create_site_top();
create_top_menu();
echo '<div class="login">';
// Show possible messages (eg. if login is succesfully made or
// if something has failed in login or something like that).
show_message();
// If we are not logged in, show login form.
if (!isset($_SESSION['username'])) {
    create_login_form();
}
echo '</div>';
// Create HTML end tags.
create_site_bottom();
?>
Example #6
0
function main()
{
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    } else {
        $action = 'list';
    }
    create_html_start();
    check_post_values();
    // Just list todos
    if ($action == 'list') {
        list_todos();
    } else {
        if ($action == 'edit') {
            show_edit();
        } else {
            if ($action == 'delete') {
                if (isset($_GET['id'])) {
                    delete_todo($_GET['id']);
                }
            } else {
                if ($action == 'finished') {
                    if (isset($_GET['id'])) {
                        finish_todo($_GET['id']);
                        list_todos();
                    }
                } else {
                    if ($action == 'show_finished') {
                        show_finished();
                    }
                }
            }
        }
    }
    create_html_end();
}
Example #7
0
function main()
{
    create_html_start();
    // If check_post_values returns true, then new
    // user is succesfully created (or at least it should be...)
    // Note that show_error_msg shows message where is
    // message that user is registered succesfully!
    if (check_post_values()) {
        show_error_msg();
        echo '<br />';
        echo '<a href="index.php">Back to main page</a>';
    } else {
        show_error_msg();
        create_register_form();
    }
    create_html_end();
}
Example #8
0
function main()
{
    create_html_start();
    check_post_values();
    $path = 'users/' . $_SESSION['ms_username'] . '/';
    if (!isset($_GET['catalog'])) {
        echo 'You must give catalog name!';
    } else {
        // Catalog file not found!
        if (!file_exists($path . $_GET['catalog̈́'])) {
            echo 'You don\'t have catalogue with that name!';
        } else {
            create_list($_GET['catalog']);
        }
        echo '<center>';
        echo '<br />';
        echo '<a href="index.php">Back to main page</a>';
        echo '</center><br />';
        create_html_end();
    }
}