$max = $meeting['participantCount']; } } } */ // Check for the first meeting available with status = 1 // (there should be only one at a time, as createMeeting checks for that first if (!empty($meetings)) { foreach ($meetings as $meeting) { if ($meeting['status'] == 1) { $selectedMeeting = $meeting; } } } if (!empty($selectedMeeting)) { $url = $om->joinMeeting($selectedMeeting['id']); if ($url) { header('location: ' . $url); exit; } } else { if ($om->isTeacher()) { $om->createMeeting($meeting_params); exit; } else { $url = 'listing.php'; header('location: ' . $url); exit; } } } else {