Get the pin length from the database.

This commit is contained in:
Mark Crane 2013-01-08 21:09:18 +00:00
parent 1c3e012368
commit 5f000bc160
1 changed files with 19 additions and 21 deletions

View File

@ -94,14 +94,20 @@ function get_meeting_pin($length, $meeting_uuid) {
} }
//generate the pins //generate the pins
if ($action == "add") { $sql = "select conference_center_pin_length from v_conference_centers ";
$length = 9; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (strlen($moderator_pin) > 0) { $sql .= "and conference_center_uuid = '".$conference_center_uuid."' ";
$moderator_pin = get_meeting_pin($length, $meeting_uuid); $prep_statement = $db->prepare(check_sql($sql));
} if ($prep_statement) {
if (strlen($moderator_pin) > 0) { $prep_statement->execute();
$participant_pin = get_meeting_pin($length, $meeting_uuid); $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
} $pin_length = $row['conference_center_pin_length'];
}
if (strlen($moderator_pin) == 0) {
$moderator_pin = get_meeting_pin($pin_length, $meeting_uuid);
}
if (strlen($participant_pin) == 0) {
$participant_pin = get_meeting_pin($pin_length, $meeting_uuid);
} }
//delete the user //delete the user
@ -181,19 +187,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg .= "Please provide a unique participant pin number.<br>\n"; $msg .= "Please provide a unique participant pin number.<br>\n";
} }
} }
$sql = "select conference_center_pin_length from v_conference_centers "; if (strlen($moderator_pin) != $pin_length) {
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $msg .= "Please provide a moderator PIN number that is the required length\n";
$sql .= "and conference_center_uuid = '".$conference_center_uuid."' "; }
$prep_statement = $db->prepare(check_sql($sql)); if (strlen($participant_pin) != $pin_length) {
if ($prep_statement) { $msg .= "Please provide a participant PIN number that is the required length\n";
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if (strlen($moderator_pin) != $row['conference_center_pin_length']) {
$msg .= "Please provide a moderator PIN number that is the required length\n";
}
if (strlen($participant_pin) != $row['conference_center_pin_length']) {
$msg .= "Please provide a participant PIN number that is the required length\n";
}
} }
} }