function get_user_data()
{
    if (isset($_SESSION['user_data']) === false) {
        $unique_id = uniqid();
        $data = array('id' => $unique_id, 'info' => array('name' => 'Guest_' . $unique_id));
        save_user_data($data);
    }
    return $_SESSION['user_data'];
}
function set_error($message, $field_name = '', $now = false)
{
    if (isset($message) and $message != '') {
        // Copy values entered into session so user doesn't have to re-enter everything
        save_user_data();
        // Set the message
        $_SESSION['message'][] = $message;
        // Set the element(s) to highlight
        if ($field_name != '') {
            $_SESSION['ERROR_FIELD'][] = $field_name;
        }
        // Specify that session support is enabled
        $_SESSION['session_support'] = '<span class="good">Enabled</span>';
        // There was a request for immediate redirect
        if ($now === true) {
            header('Location: index.php?sessions_checked=true');
            exit;
        }
    }
}
Exemple #3
0
    Chromephp::log($friends);
    Chromephp::log($friends['data']);
    Chromephp::log($friends['data'][0]->name);
    Chromephp::log($friends['data'][0]->id);
    $friendsString = '';
    // use this string to save into the friendslist...
    $sizeofFriendlist = count($friends['data']);
    for ($x = 0; $x < $sizeofFriendlist; $x++) {
        $currentFriend = $friends['data'][$x]->name;
        if ($friendsString == '') {
            $friendsString = $currentFriend;
            continue;
        }
        $friendsString = $friendsString . ', ' . $currentFriend;
    }
    save_user_data($fbid, $fbfullname, $femail, $friendsString);
    header('Location: http://localhost/CourseMatch/CourseFinder.php');
} else {
    // there is no session and we redirect to the login page...
    Chromephp::log("there is no session here");
    $loginUrl = $helper->getLoginUrl(array("user_friends", "user_status", "email", "public_profile"));
    Chromephp::log($loginUrl);
    header("Location: " . $loginUrl);
}
function save_user_data($fbid, $fbfullname, $email, $friends)
{
    Chromephp::log("this function is being called right now");
    // connect to the db here
    $db = "CourseMatcher";
    $servername = "localhost";
    $username = "******";
Exemple #4
0
 case "addproject":
     admin_check();
     draw_page_top($page);
     draw_project_maintenance_form($user_table);
     draw_page_bottom();
     break;
     # SAVE POSTED NEW USER DATA.  IN: $user_data[] array, $notify_user flag
 # SAVE POSTED NEW USER DATA.  IN: $user_data[] array, $notify_user flag
 case "saveuser":
     admin_check();
     if ($just_posted) {
         $user_data = $_POST["user_data"];
         $notify_user = $_POST["notify_user"];
         $apache_vars = $_SERVER;
         draw_page_top($page);
         save_user_data($user_data, $user_table, $notify_user, $apache_vars);
         draw_page_bottom();
     }
     break;
     # SAVE POSTED NEW PROJECT DATA.  IN: $project_data[] array
 # SAVE POSTED NEW PROJECT DATA.  IN: $project_data[] array
 case "saveproject":
     admin_check();
     if ($just_posted) {
         $project_data = $_POST["project_data"];
         draw_page_top($page);
         save_project_data($project_data, $project_table);
         draw_page_bottom();
     }
     break;
     ###################################