From 5f000bc160e0fecec21ee3b767dbab620e0958b2 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 8 Jan 2013 21:09:18 +0000 Subject: [PATCH] Get the pin length from the database. --- .../conference_room_edit.php | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php index 3891a440f4..f383c27db4 100644 --- a/app/conference_centers/conference_room_edit.php +++ b/app/conference_centers/conference_room_edit.php @@ -94,14 +94,20 @@ function get_meeting_pin($length, $meeting_uuid) { } //generate the pins - if ($action == "add") { - $length = 9; - if (strlen($moderator_pin) > 0) { - $moderator_pin = get_meeting_pin($length, $meeting_uuid); - } - if (strlen($moderator_pin) > 0) { - $participant_pin = get_meeting_pin($length, $meeting_uuid); - } + $sql = "select conference_center_pin_length from v_conference_centers "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and conference_center_uuid = '".$conference_center_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $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 @@ -181,19 +187,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg .= "Please provide a unique participant pin number.
\n"; } } - $sql = "select conference_center_pin_length from v_conference_centers "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and conference_center_uuid = '".$conference_center_uuid."' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $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"; - } + if (strlen($moderator_pin) != $pin_length) { + $msg .= "Please provide a moderator PIN number that is the required length\n"; + } + if (strlen($participant_pin) != $pin_length) { + $msg .= "Please provide a participant PIN number that is the required length\n"; } }