[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.220.81.170: ~ $
<?php
	$page_title = "E-mail Session Attendees | CES Admin";
    include_once($_SERVER['DOCUMENT_ROOT'] . "/php/common_functions.php"); //common functions in the course registartion system
    include_once($_SERVER['DOCUMENT_ROOT'] . "/php/config.php"); //holds global config variables
	require_once($_SERVER['DOCUMENT_ROOT'] . "/phplist/config/config.php"); //phplist config values
 	check_if_authenticated('admin');//check if user is logged in
    include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/php/top-admin.php"); //get the HTML heading common to all pages in the CES admin module
    
?>

 <article class="ces-admin">
        <h2>CES Admin - E-mail Session Attendees</h2>


<?php
	include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/php/nav-admin.php");
 	//opens connection to database

	$db = mysqli_connect($mysql_server, $user, $pass, $database);

	$success_count = 0;
	$error_count = 0;
	$msg = '';

	
	if($_POST['submit']){ //form has been submitted, send email out
	
		if(empty($_POST['subject']) || empty($_POST['message'])){
			echo "\n<p class='alert alert-error'>An error occurred: the e-mail subject and message fields can't be blank.</p>";
		}//if
		else{

				switch ($_POST['email_type']) {
				    case 'registered':
				        $email_conditions = "AND session.on_waiting_list = 0";
				        break;
				    case 'inperson':
				        $email_conditions = "AND session.on_waiting_list = 0 AND session.via_video = 0 AND session.via_audio = 0";
				        break;
				    case 'waitlist':
				        $email_conditions = "AND session.on_waiting_list = 1";
				        break;
				    case 'telehealth':
				        $email_conditions = "AND session.via_video = 1";
				        break;
				    case 'audioline':
				        $email_conditions = "AND session.via_audio = 1";
				        break;
				    case 'remote':
				        $email_conditions = "AND (session.via_video = 1 OR session.via_audio = 1)";
				        break;
				    case 'all':
				        $email_conditions = "";
				        break;
				    default:
				       $email_conditions = "AND user.id = 0";
				}

			

			//get all the session attendees - only send emails to those that are not on the waiting list
			$session_sql = mysqli_query($db, "SELECT user.email
			FROM ces_course_registration session 
			LEFT OUTER JOIN phplist_user_user user ON session.id = user.id
			WHERE session.session_id = '$_POST[session_id]'
			$email_conditions");
			
			while ($session_query = mysqli_fetch_array($session_sql)){
				$return_code = fcrc_send_email($session_query['email'], $_POST['subject'], $_POST['message']);
				if($return_code == 1){
					//email seny successfully
					$msg .= "\n<p class='alert alert-success'>Sent email to " . $session_query['email'] . " successfully.</p>";
					$success_count++;
				}//if
				else{
					//there was a problem sending the email
					$msg .= "\n<p class='alert alert-error'>There was a problem sending the email to " . $session_query['email'] . "Please include this error message when reporting this problem: <br>PHPMailer error: " . $return_code . "</p>";
					$error_count++;
				}//else
			}//while

			echo "<p class='alert alert-info'>";
			echo "Emails Sent: ".$success_count."<br>";
			echo "Errors: ".$error_count;
			echo "</p>";
			echo $msg;
			echo "<a class='btn btn-lg btn-block ces-orange-btn' href='attendees.php?session_id=". $_POST['session_id']."'>Attendees List</a>";
		}//else
		
	}//if
	else{ //show form to email session attendees
		if(isset($_GET['email_type'])){
				switch ($_GET['email_type']) {
				    case 'registered':
				        $email_type = "In Person, Telehealth, &amp; Audioline";
				        break;
				    case 'inperson':
				        $email_type = "In Person";
				        break;
				    case 'waitlist':
				        $email_type = "Waitlist";
				        break;
				    case 'telehealth':
				        $email_type = "Telehealth";
				        break;
				    case 'audioline':
				        $email_type = "Audioline";
				        break;
				    case 'remote':
				        $email_type = "Telehealth &amp; Audioline";
				        break;
				    case 'all':
				        $email_type = "In Person, Telehealth, Audioline, &amp; Waitlist";
				        break;
				    default:
				       $email_type = "No user group selected. No emails will be sent.";
				}
			echo "<p class='alert alert-warning'>The email will be sent to the following group(s):<br><br>";
			echo "<strong>".$email_type."</strong>";
			}

			

		//get the session details so can show which session we are sending the email for
		$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, location.location_name, location.address_line1, location.address_line2, location.city, location.province, location.postal_code 
		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.session_id = '$_GET[session_id]'
		AND location.telehealth = 0");
		
		while ($session_query = mysqli_fetch_array($session_sql)){
	?>

		<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>

		    <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
		}//while
?>
		<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
			<div class="form-group">
				<label for="subject">Subject:</label>
				<input class="form-control"  type='text' name='subject' size='75' maxlength='100' required placeholder="Subject">
			</div>
			<div class="form-group">
				<label for="message">Message:</label>
				<textarea class="form-control" style="height:auto; resize:none;" rows='20' name='message' wrap='soft' required placeholder="Message Body"></textarea>
			</div>
				
			<p class="alert alert-info">Note: CES footer will be added to the end of this e-mail automatically<p>
			
			<input type="hidden" name="session_id" value="<?php echo $_GET['session_id']; ?>"> 
			<input type="hidden" name="email_type" value="<?php echo $_GET['email_type']; ?>"> 
			
			<input type='submit' name='submit' value="Send E-mail" class="btn btn-lg btn-block ces-green-btn">

			<a class='btn btn-lg btn-block ces-orange-btn' href='attendees.php?session_id=<?php echo $_GET['session_id'] ?>'>Cancel</a>
			
		</form>
<?php
	}//else
	
?>

  </article>
    


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

</div><!-- #wrapper --> 
 
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>

Filemanager

Name Type Size Permission Actions
files Folder 0755
add.php File 11.66 KB 0644
attendees.php File 19.54 KB 0644
edit.php File 22.29 KB 0644
email-attendees.php File 8.04 KB 0644
error_log File 9.19 KB 0644
remove-attendee.php File 6.17 KB 0644