include "inc/function.php";
if (isset($_POST['action']) && !empty($_POST['action'])) {
    $action = $_POST['action'];
} elseif (isset($_GET['action']) && !empty($_GET['action'])) {
    $action = $_GET['action'];
}
echo $_POST['action'];
switch ($action) {
    case 'get_user_details':
        get_user_details();
        break;
    case 'get_permission':
        get_permission();
        break;
    case 'save_user_details':
        save_user_details();
        break;
    case 'logout_user':
        logout_user();
        break;
    case 'get_user_email':
        get_user_email();
        break;
    case 'getfd':
        get_full_details();
        break;
    case 'reset':
        clear_session();
        break;
    case 'chgpfl':
        update_profile_details();
<?php

// Include the linkvault API
// would be autoloaded by composer
include_once './LinkvaultApi.php';
// Grab the user input from the form
// this example is quite contrived, remember to secure your code properly
$name = $_POST['name'];
$email = $_POST['email'];
function save_user_details($name, $email)
{
    // Save the user details to a database here
    return TRUE;
}
// What we are doing here is calling the save
// user details function, if the function succeeds
// we will call the linkvau.lt api and get a secure
// download link to display to our user
if (save_user_details($name, $email) == TRUE) {
    $api = new \Clearmediaukltd\Linkvault\LinkvaultApi('98acc3cb401bd03aa5253a56ae25f73548b5c44c');
    $link_url = $api->getDownloadUrl('6LWH69q6');
    if ($link_url != '') {
        echo '<a href="' . $link_url . '">Click here to download the file</a>';
    } else {
        echo 'There was a problem';
    }
}
        save_base_info($dbh, $table_prefix);
        break;
    case 3:
        save_awards($dbh, $table_prefix);
        break;
    case 4:
        delete_award($dbh, $table_prefix);
        break;
    case 5:
        save_project_image($dbh, $table_prefix);
        break;
    case 6:
        save_description($dbh, $table_prefix);
        break;
    case 7:
        save_user_details($dbh, $table_prefix);
        break;
    case 8:
        submit_project($dbh, $table_prefix);
        break;
}
function first_step($dbh1, $table_prefix)
{
    if ($stmt = $dbh1->prepare("INSERT INTO " . $table_prefix . "_projects (userID, terms_accepted, last_page_filled) VALUES (?, ?, ?)")) {
        $stmt->bindParam(1, $_SESSION['user_id']);
        $stmt->bindParam(2, $terms = 1);
        $stmt->bindParam(3, $last_page = 2);
        $stmt->execute();
        $_SESSION['curent_new_project_ID'] = $dbh1->lastInsertId();
        echo $dbh1->lastInsertId();
        //returning the new project ID