redirect.php 738 B

1234567891011121314151617181920212223
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Redirects a session name to a correct session id.
  5. */
  6. $cidReset = true;
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. $sessionName = isset($_GET['session_name']) ? $_GET['session_name'] : '';
  9. $courseCode = isset($_GET['cidReq']) ? $_GET['cidReq'] : '';
  10. if (!empty($sessionName) && !empty($courseCode)) {
  11. $sessionInfo = SessionManager::get_session_by_name($sessionName);
  12. $courseInfo = api_get_course_info($courseCode);
  13. if (!empty($sessionInfo) && !empty($courseInfo)) {
  14. $url = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/index.php?id_session='.$sessionInfo['id'];
  15. header('Location: '.$url);
  16. exit;
  17. }
  18. }
  19. api_not_allowed(true);