if ($_REQUEST['rating'] === 'no') { $rating = '0'; } else { $rating = intval($_REQUEST['rating']); } } else { $rating = ''; } if (isset($_REQUEST['owner']) && !empty($_REQUEST['owner']) && is_pos_int($_REQUEST['owner'])) { $owner_search = true; $owner = $_REQUEST['owner']; } else { $owner_search = false; } if (isset($_REQUEST['rxn']) && !empty($_REQUEST['rxn'])) { $rxn = check_rxn($_REQUEST['rxn']); } else { $rxn = ''; } if (isset($_REQUEST['structsearchtype']) && !empty($_REQUEST['structsearchtype'])) { $structSearchType = check_search_type($_REQUEST['structsearchtype']); } else { $structSearchType = 'exact'; } if (isset($_REQUEST['tanimoto'])) { $tanimoto = floatval($_REQUEST['tanimoto']); } else { $tanimoto = 0.7; } $userid = intval($_SESSION['userid']); // Is there a search ?
if (isset($_REQUEST['to']) && !empty($_REQUEST['to'])) { $to = floatval($_REQUEST['to']); } else { $to; } if (isset($_REQUEST['rating']) && !empty($_REQUEST['rating'])) { if ($_REQUEST['rating'] === 'no') { $rating = '0'; } else { $rating = intval($_REQUEST['rating']); } } else { $rating = ''; } if (isset($_REQUEST['mol']) && !empty($_REQUEST['mol'])) { $mol = check_rxn($_REQUEST['mol']); } else { $mol = ''; } if (isset($_REQUEST['structsearchtype']) && !empty($_REQUEST['structsearchtype'])) { $structSearchType = check_search_type($_REQUEST['structsearchtype']); } else { $structSearchType = 'exact'; } if (isset($_REQUEST['tanimoto'])) { $tanimoto = floatval($_REQUEST['tanimoto']); } else { $tanimoto = 0.7; } if (isset($_REQUEST['validated'])) { $getValidated = true;
$req = $bdd->prepare($sql); $result = $req->execute(array('regno' => check_title($_POST['cpdParentRegNum']))); $ids = $req->fetch(); if (count($ids) === 2) { $parentregid = $ids[0]; } else { $msg_arr[] = 'The parent registration ID for the salt is not valid!'; $errflag = true; } } else { $msg_arr[] = 'The parent registration ID for the salt is not valid!'; $errflag = true; } } } $mol = check_rxn($_POST['mol']); $cas_number = isset($_POST['cas_number']) && $_POST['cas_number'] !== '' ? $_POST['cas_number'] : null; $pubchem_id = isset($_POST['pubchem_id']) && $_POST['pubchem_id'] !== '' ? $_POST['pubchem_id'] : null; $chemspider_id = isset($_POST['chemspider_id']) && $_POST['chemspider_id'] !== '' ? $_POST['chemspider_id'] : null; $mwt = isset($_POST['mwt']) ? floatval($_POST['mwt']) ? floatval($_POST['mwt']) : null : null; $exact_mass = isset($_POST['exact_mass']) ? floatval($_POST['exact_mass']) ? floatval($_POST['exact_mass']) : null : null; $density = isset($_POST['density']) ? floatval($_POST['density']) ? floatval($_POST['density']) : null : null; $notes = check_body($_POST['notes']); $formula = isset($_POST['formula']) ? $_POST['formula'] : null; // If input errors, redirect back to the experiment form if ($errflag) { $_SESSION['errors'] = $msg_arr; session_write_close(); header("location: compounds.php?mode=view®id={$regid}"); exit; }
} else { $id = ''; $msg_arr[] = 'The id parameter is not valid !'; $errflag = true; } $title = check_title($_POST['title']); $date = check_date($_POST['date']); $body = check_body($_POST['body']); $status = check_status($_POST['status']); $bodyChanged = check_bool($_POST['body_changed']); $titleChanged = check_bool($_POST['title_changed']); $oldid = $_POST['oldid']; // not sanitised! This is not committed to the db. $type = $_POST['type']; if ($type === 'chemsingle') { $rxn = check_rxn($_POST['rxn_input']); $grid = $_POST['grid_input']; $prodGrid = $_POST['prodGrid_input']; $gridColumns = $_POST['grid_columns']; $prodGridColumns = $_POST['prodGrid_columns']; $rxnChanged = check_bool($_POST['rxn_changed']); $gridChanged = check_bool($_POST['grid_changed']); $prodGridChanged = check_bool($_POST['prodGrid_changed']); $gridColumnsChanged = check_bool($_POST['gridColumns_changed']); $prodGridColumnsChanged = check_bool($_POST['prodGridColumns_changed']); $rxn_png = $_POST['rxn_png']; } else { $rxnChanged = false; $gridChanged = false; $prodGridChanged = false; $gridColumnsChanged = false;