function pair_neworphan($email) { // check in what table user is: a voter or a petitioner $table = "votaxmi_voter"; $sql_find_user_table = "select email from {$table} WHERE email='{$email}';"; $result = mysqli_query($db_con, $sql_find_user_table); $rowcount = mysqli_num_rows($result); if ($rowcount != 1) { $table = "votaxmi_petitioner"; $table2 = "votaxmi_voter"; $casetype = "match_petitioner_with_voter"; } else { $table2 = "votaxmi_petitioner"; $casetype = "match_voter_with_petitioner"; } $match = pairsystem($email, $table2, $table); if ($match == "nomatch") { mail_alert_divorce($email); } else { mail_alert_divorce($email); email_match_confirmation($email, $match, $casetype); } //end of if ( $match == "nomatch" ) }
if ($key_received == $row["activation_code"]) { // key match so try to activate user in the DB $sql_update = "UPDATE {$table} SET confirmed=1 WHERE email='{$email}'"; //1.a.1)if fails to update because a db connection issue, die. else try to find a pair if (!mysqli_query($db_con, $sql_update)) { $info_error = mysqli_error($db_con); header('Location: ../event.php?event=21&info=' . $info_error); mysqli_close($db_con); exit; //1.a.2) } else { //clean the activation code. no problem to leave so no problem if a fail arise. no need to alert $sql_clean_activation_code = "UPDATE {$table} SET activation_code=0 where email='{$email}'"; mysqli_query($db_con, $sql_clean_activation_code); // ACTIVATED WORKED OK IN THE db. now find a pair and send and email with the result. $match = pairsystem($email, $table2, $table); if ($match == "nomatch") { header('Location: ../event.php?event=3'); mysqli_close($db_con); exit; } else { email_match_confirmation($email, $match, $casetype); if ($result_email == "fallo") { header('Location: ../event.php?event=24'); mysqli_close($db_con); exit; } else { header('Location: ../event.php?event=2'); mysqli_close($db_con); exit; }