}
         } else {
             $error = "Only .pdf file type is allowed";
         }
     } else {
         $error = "Select a user first";
     }
 }
 if (isset($_POST['deleteCVFormSubmit'])) {
     if (isset($_SESSION['selectedUsername'])) {
         $selectedUsername = $_SESSION['selectedUsername'];
         if (hasCVUploadedOnce($selectedUsername)) {
             $cvFilePath = getCVPathByUsername($selectedUsername);
             unlink($cvFilePath);
             deleteCVPath($selectedUsername);
             $cvFilePath = getCVPathByUsername($selectedUsername);
             $isCVDeleteSuccess = true;
         } else {
             $isCVDeleteSuccess = false;
         }
     }
 }
 if (isset($_SESSION['selectedUsername'])) {
     $selectedUsername = $_SESSION['selectedUsername'];
     $selectedUserProfileDetails = getProfileDetailsByUsername($selectedUsername);
     $selectedUserEmail = $selectedUserProfileDetails["email"];
     $selectedUserFirstName = $selectedUserProfileDetails["first_name"];
     $selectedUserLastName = $selectedUserProfileDetails["last_name"];
     $selectedUserGender = $selectedUserProfileDetails["gender"];
     $selectedUserAddress1 = $selectedUserProfileDetails["address_line1"];
     if (isset($selectedUserProfileDetails["address_line2"])) {
        $selectedUserFirstName = $selectedUserProfileDetails["first_name"];
        $selectedUserLastName = $selectedUserProfileDetails["last_name"];
        $selectedUserGender = $selectedUserProfileDetails["gender"];
        $selectedUserAddress1 = $selectedUserProfileDetails["address_line1"];
        if (isset($userProfileDetails["address_line2"])) {
            $selectedUserAddress2 = $userProfileDetails["address_line2"];
        } else {
            $selectedUserAddress2 = "";
        }
        $selectedUserCountry = $selectedUserProfileDetails["country"];
        if (isset($userProfileDetails["contact_number"])) {
            $selectedUserContactNumber = $userProfileDetails["contact_number"];
        } else {
            $selectedUserContactNumber = "";
        }
        $cvFilePath = getCVPathByUsername($searchedUsername);
        $projectArray = getProjectsListByUsername($searchedUsername);
    } else {
        redirect_to("search");
    }
    if (isset($connection)) {
        mysql_close($connection);
    }
} else {
    redirect_to("search");
}
?>

<head>
    <title>Be Linked! View user</title>
        <link rel="stylesheet" href="css/layout.css" type="text/css">
                    unlink($cvFilePath);
                }
                move_uploaded_file($_FILES["cvFile"]["tmp_name"], $finalFilePath);
                manageCV($username, $finalFilePath);
                $cvFilePath = getCVPathByUsername($username);
            }
        } else {
            $error = "Only .pdf file type is allowed";
        }
    }
    if (isset($_POST['deleteCVFormSubmit'])) {
        if (hasCVUploadedOnce($username)) {
            $cvFilePath = getCVPathByUsername($username);
            unlink($cvFilePath);
            deleteCVPath($username);
            $cvFilePath = getCVPathByUsername($username);
            $isDeleteSuccess = true;
        } else {
            $isDeleteSuccess = false;
        }
    }
} else {
    redirect_to("home");
}
?>

<script type="text/javascript" language="javascript">
 
    function hasConfirmDeleteCV(){
		<?php 
if (hasCVUploadedOnce($username)) {