Skip to content

Commit

Permalink
fix bug in photolysis rate creation
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 5, 2022
1 parent 417ed6b commit 3fc8c3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions login/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
if(!$_POST['pass']){
die('You did not fill in a password.');
}
$_POST['username'] = pg_escape_string($_POST['username']);
$check = pg_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die("user not available from db");
$check2 = pg_num_rows($check);
if ($check2 != 1){
Expand Down
6 changes: 2 additions & 4 deletions php/photolysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ function add_photolysis_and_products (){
global $con;

$result = pg_prepare($con, "add_photolysis",
"INSERT INTO photolysis (rate, moleculename, wrf_photo_rates_id, wrf_photo_rates_coeff, micm_js_id, micm_js_coeff, group_id) VALUES ($1, $2, $3, $4, $5) RETURNING id;");
"INSERT INTO photolysis (rate, moleculename, wrf_photo_rates_id, wrf_photo_rates_coeff, group_id) VALUES ($1, $2, $3, $4, $5) RETURNING id;");

$result = pg_prepare($con, "add_photolysis_products",
"INSERT INTO photolysisproducts (photolysisid, moleculename, coefficient) VALUES ($1,$2, $3);");
Expand All @@ -467,8 +467,6 @@ function add_photolysis_and_products (){
$molecule = $data->molecule;
$rate = $data->rate;
$productArray = $data->productArray;
$micm_js_id = $data->micm_js_id;
$micm_js_coeff = $data->micm_js_coeff;
$wrf_photo_rates_id = $data->wrf_photo_rates_id;
$wrf_photo_rates_coeff = $data->wrf_photo_rates_coeff;
$newComment = $data->newComment;
Expand All @@ -480,7 +478,7 @@ function add_photolysis_and_products (){
$out .= "Begin Transaction, safe:".$safe_to_commit."\n";

// add photolysis
$result = pg_execute($con, "add_photolysis", array($rate, $molecule, $wrf_photo_rates_id, $wrf_photo_rates_coeff, $micm_js_id, $micm_js_coeff, $group_id));
$result = pg_execute($con, "add_photolysis", array($rate, $molecule, $wrf_photo_rates_id, $wrf_photo_rates_coeff, $group_id));
$out = $out . "molecule:".$molecule.":rate:".$rate.":\n";
$new_photolysis_id = pg_fetch_array($result)[0];
$out = $out . "pid:".$new_photolysis_id."\n";
Expand Down

0 comments on commit 3fc8c3d

Please sign in to comment.