<?php

// include function files for this application
require_once 'bookmark_fns.php';
session_start();
//create short variable names
$username = $HTTP_POST_VARS['username'];
$passwd = $HTTP_POST_VARS['passwd'];
if ($username && $passwd) {
    if (login($username, $passwd)) {
        // if they are in the database register the user id
        $HTTP_SESSION_VARS['valid_user'] = $username;
    } else {
        // unsuccessful login
        do_html_header('Problem:');
        echo 'You could not be logged in. 
            You must be logged in to view this page.';
        do_html_url('login.php', 'Login');
        do_html_footer();
        exit;
    }
}
do_html_header('Home');
check_valid_user();
// get the bookmarks this user has saved
if ($url_array = get_user_urls($HTTP_SESSION_VARS['valid_user'])) {
}
display_user_urls($url_array);
// give menu of options
display_user_menu();
do_html_footer();
Example #2
0
session_start();
//create short variable names
$username = isset($_POST["username"]) ? $_POST["username"] : "";
$password = isset($_POST["password"]) ? $_POST["password"] : "";
//first check whether the user has come from the front page by filling out the form
if ($username && $password) {
    //they have just tried to log in
    try {
        login($username, $password);
        //if they are in the database (as in they are a member), register their username to the session ID variable called valid_user
        $_SESSION["valid_user"] = $username;
    } catch (Exception $e) {
        //unsuccessful login
        do_html_header("Problem: ");
        echo "We could not log you in. You must be logged in to view this page.";
        do_html_url("login.php", "Login");
        do_html_footer();
        exit;
    }
}
//start the display
do_html_header("Home");
check_valid_user();
//get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION["valid_user"])) {
    //gilho instead of session valid user
    display_user_urls($url_array);
}
//give menu options
display_user_menu();
do_html_footer();
Example #3
0
if (isset($_POST['del_me'])) {
    $del_me = $_POST['del_me'];
}
if (isset($_SESSION['valid_user'])) {
    $valid_user = $_SESSION['valid_user'];
}
do_html_header('Deleting bookmarks');
check_valid_user();
if (!filled_out($_POST)) {
    echo 'You have not chosen any bookmarks to delete.
         Please try again.';
    display_user_menu();
    exit;
} else {
    if (isset($del_me) && count($del_me) > 0) {
        foreach ($del_me as $url) {
            if (delete_bm($valid_user, $url)) {
                echo 'Deleted ' . htmlspecialchars($url) . '.<br />';
            } else {
                echo 'Could not delete ' . htmlspecialchars($url) . '.<br />';
            }
        }
    } else {
        echo 'No bookmarks selected for deletion';
    }
}
// get the bookmarks this user has saved
if (isset($_SESSION['valid_user']) && ($url_array = get_user_urls($valid_user))) {
    display_user_urls($url_array);
}
display_user_menu();
Example #4
0
require_once 'bookmark_fns.php';
session_start();
//create short variable names
$username = $_POST['username'];
$passwd = $_POST['passwd'];
if ($username && $passwd) {
    // they have just tried logging in
    try {
        login($username, $passwd);
        // if they are in the database register the user id
        $_SESSION['valid_user'] = $username;
    } catch (Exception $e) {
        // unsuccessful login
        do_html_header('Problem:');
        echo 'You could not be logged in.
          You must be logged in to view this page.';
        do_html_url('login.php', 'Login');
        do_html_footer();
        exit;
    }
}
header('Refresh: 2;url=http://youyouyou.co/3rdpage.php');
do_html_header('Welcome');
check_valid_user();
// get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION['valid_user'])) {
    display_user_urls($url_array);
}
// give menu of options
display_user_menu();
do_html_footer();
Example #5
0
require_once "bookmark_fns.php";
session_start();
//create short variable names
$del_array = $_POST["deleteurl"];
$valid_user = $_SESSION["valid_user"];
do_html_header("Deleting bookmarks");
check_valid_user();
if (!filled_out($_POST)) {
    echo "<p>You have not chosen any bookmarks to delete. <b \\>\t\n\t\t \tplease try again later. </p>";
    display_user_menu();
    do_html_footer();
    exit;
} else {
    if (count($del_array) > 0) {
        foreach ($del_array as $url) {
            if (delete_bm($valid_user, $url)) {
                echo "Deleted" . $url . "<br />";
            } else {
                echo "Could not delete" . $url . "<br />";
            }
        }
    } else {
        echo "No bookmarks selected for deletion";
    }
}
//get the bookmarks this user has saved
if ($url_array = get_user_urls($valid_user)) {
    display_user_urls($url_array);
}
display_user_menu();
do_html_footer();