예제 #1
0
 }
 //get the note message text
 if (isset($_POST['noteText'])) {
     $noteText = $_POST['noteText'];
     //make sure the message isn't empty
     if (empty($noteText)) {
         $validated = false;
     } else {
         //include the user object code
         include_once 'User.php';
         //get the logged in user
         $userObj = $_SESSION['UserObj'];
         //save the user id
         $userID = $userObj->getID();
         //submit the note
         $success = submitNote($hgnc_gene_text, $userID, $noteText);
         if (!$success) {
             echo '<div class="err">Error submitting the note</div>';
         }
     }
 }
 //attempt to identify hgvs genomic, hgnc_gene, and phenotype_id for informational tags at the top
 if (isset($_POST['HGVSgenomic'])) {
     $HGVSgenomic = $_POST['HGVSgenomic'];
 } else {
     $HGVSgenomic = NULL;
 }
 if (isset($_POST['hgnc_gene'])) {
     $hgnc_gene = $_POST['hgnc_gene'];
 } else {
     $hgnc_gene = NULL;
// handle POST submission
if (isset($_POST['submit'])) {
    $submissionSuccessful = false;
    $dbPictureID = $_POST['pictureID'];
    $dbSymbol = $_POST['symbol'];
    $dbDuration = $_POST['duration'];
    $dbDurationInput = $_POST['durationInput'];
    $dbPitch = $_POST['pitch'];
    $dbPitchInput = $_POST['pitchInput'];
    $dbAccidental = $_POST['accidental'];
    $dbLevel = $_POST['level'];
    $dbDotted = isset($_POST['dotted']) ? true : false;
    $dbIP = $_SERVER['REMOTE_ADDR'];
    if ($dbSymbol === "note") {
        if ($dbDuration !== "none" && $dbPitch !== "none") {
            submitNote($dbPictureID, $dbSymbol, $dbDuration, $dbDurationInput, $dbPitch, $dbPitchInput, $dbAccidental, $dbDotted, $dbIP, $dbLevel, $mysqli);
            $submissionSuccessful = true;
        }
    } elseif ($dbSymbol === "pause") {
        if ($dbDuration !== "none") {
            submitPause($dbPictureID, $dbSymbol, $dbDuration, $dbDurationInput, $dbDotted, $dbIP, $dbLevel, $mysqli);
            $submissionSuccessful = true;
        }
    }
    // "post redirect get" pattern
    // avoids multiple submission after browser refresh
    $_SESSION['submitted'] = $submissionSuccessful;
    header("HTTP/1.1 303 See Other");
    header("Location: " . $_SERVER['PHP_SELF']);
    exit;
}