[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.117.100.130: ~ $
<?php
	$page_title = "Course Registration";
	include_once("config.php"); //holds global config variables
	include_once("common_functions.php"); //include some common functions
	require_once($_SERVER['DOCUMENT_ROOT'] . "/phplist/config/config.php"); //phplist config values                
 		
	if(is_admin_logged_in()){ //if user is logged in, format page accordingly
		include_once("admin_html_top.php"); //get the HTML heading common to all pages in the CES admin module
	}//if
	else{
        check_if_authenticated('user');//check if user is logged in
		include("public_top.php"); //the HTML that outlines the top of the page for a user's view
	}//else
?>

 <article>
        <h2>CES Register for Session</h2>

<?php
	if(is_admin_logged_in()){ //if user is logged in, format page accordingly
		//include_once("ces_admin_nav.php"); //get the HTML nav common to all pages in the CES admin module
	}


	//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'];

	//first make sure that the person is not already registered in the session
	$check_id_sql = mysqli_query($db, "SELECT COUNT(*) FROM 
	
	_course_registration WHERE session_id = '$_GET[session_id]' and id = '$_GET[id]'");
	$already_registered = mysqli_fetch_row($check_id_sql);
  if($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>";
  }//if
  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>";
  }
  elseif (!$_POST['submit']){ //if 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
	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)){
		//2008-04-13 - wsopko - Jen at CES requested that only put people on the waiting list if the course has not started yet
		//reason for this is there are walk-ins that don't register for a course, but show up anyway, and need to be able to register them after the session starts
		//$current_date = getdate(); //current system date in local timezone 
		//$current_date_GMT = convert_system_to_GMT($current_date[0]); //convert current date to GMT since system timezone could be different than registration system timezone	
     $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(is_session_online($_GET['session_id'])){
      echo '<p class="alert alert-info">The following online 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>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(!is_session_online($session_query['session_id'])){?>
    <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_query['telehealth'] == 1){
    ?>
    	<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='/sessions/instructions/telehealth.php' class='btn ces-blue-btn' title='Via Video'><span class='glyphicon glyphicon-facetime-video'></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='/sessions/instructions/audioline.php' class='btn ces-blue-btn' title='Via Audio'><span class='glyphicon glyphicon-phone-alt'></span> Instructions</a></div>
    				</div>
    		</dd>
    	</div>
    <?php }//end if
    	if(is_session_online($session_query['session_id'])){
    ?>
    		<input type="hidden" name='attend' value="online">
    <?php	}//end if 

    if(!is_session_online($session_query['session_id'])){

      ?>

    <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. Do not include yourself in this count.</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/current/" class="btn btn-lg btn-block ces-cancel-btn">Cancel</a>
    		<input id="register-button" class="btn btn-lg btn-block" type='submit' name='submit' value="<?php echo $button_text; ?> ">
    	</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
			$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");
			
			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"];
            if ($session_query["telehealth"] == 1){
              //echo "<img class='ces-telehealth-icon' src='/images/CES_Telehealth-Icon.gif' title='This session is avalible through Telehealth'>";
              echo " <a href='sessions/instructions/audioline.php' title='Via Video'><span class='glyphicon glyphicon-phone-alt' title='Audioline Avalible'></span></a> <a href='sessions/instructions/telehealth.php' title='Via Video'><span class='glyphicon glyphicon-facetime-video' title='Telehealth/Video-Conference Avalible'></span></a>";
            }
        echo "</h3>\n";
      echo "      <p class='time'>". $start_time . " - ". $end_time . " - " ;
                      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='course_registration/user_course_list.php'>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='course_registration/user_course_list.php'>Wait-list</a>\n";
            }
          }
          else{//display register buton
            echo "    <a class='btn btn-lg btn-primary btn-block ces-register-btn' href='../../course_registration/course_registration.php?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 elseif

	else { 
    echo register_person_in_session($_POST['session_id'], $_POST['id'], $_POST['location_id'], $_POST['on_waiting_list'], '0', $_POST['attend'], $_POST['guests']);

    if(is_admin_logged_in()){
      echo "<a href='course_registration/show_all_courses.php#".get_course_id($_POST['session_id'])."' class='btn ces-blue-btn'>Show All Courses</a>";
      echo "<a href='course_registration/user_admin_course_list.php?id=".$_POST['id']."' class='btn ces-orange-btn'>User Course List</a>";
    }else{
      echo "<a href='course_registration/user_course_list.php?id=".$_POST['id']."' class='btn ces-blue-btn'>Your Course List</a>";
      echo "<a href='sessions/current/' class='btn ces-orange-btn'>Current Sessions</a>";
    }

	}//else

?>


    </article>

    
    <section id="right30">

            <?php include($_SERVER['DOCUMENT_ROOT'].'/menu.php');?> 
            <?php include($_SERVER['DOCUMENT_ROOT'].'/require/sidebar.php');?> 
    </section><!-- #sideRight -->


  </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
check_login.php File 2.56 KB 0644
common_functions.php File 69.94 KB 0644
config.php File 1.01 KB 0644
course_registration.php File 18.01 KB 0644
error_log File 110.84 KB 0644
remove_attendee.php File 7.08 KB 0644
top.php File 989 B 0644