Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/ccmadmin/
Upload File :
Current File : /var/www/cesa.co.za/ccmadmin/sendmessage.php

<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "CCMMessagesinfo.php" ?>
<?php include "CCMUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php include "header.php" ?>
<SCRIPT TYPE="text/javascript" SRC="js/filterlist.js"></SCRIPT> 
<p><b><a href="CCMMessageslist.php?cmd=resetall&order=SentDateTime&ordertype=DESC">View All Messages</a></b></p>
<p><b><a href="CCMMessagesInbox.php?order=SentDateTime&ordertype=DESC">Inbox</a></b></p>
<p><b><a href="CCMMessagesSent.php?order=SentDateTime&ordertype=DESC">Sent Items</a></b></p>
    <h1> Send a Message</h1>
<?php
$conn = mysql_connect(EW_CONN_HOST, EW_CONN_USER, EW_CONN_PASS);
mysql_select_db(EW_CONN_DB);

	$iSelectStudentID=0;
	$sReplyText = "";
	$sForwardText = "";
	if (isset($_GET["replyto"])) {
		$sql = "SELECT * FROM CCMMessages WHERE CCMMessageID='".$_GET["replyto"]."'";
		$rec = mysql_query($sql);
		if ($row = mysql_fetch_assoc($rec)) {
			$iSelectStudentID = $row["SentByStudentID"];
			$sReplyText = $row["MessageText"];
		}
		mysql_free_result($rec);
	}
	if (isset($_GET["fwd"])) {
		$sql = "SELECT * FROM CCMMessages WHERE CCMMessageID='".$_GET["fwd"]."'";
		$rec = mysql_query($sql);
		if ($row = mysql_fetch_assoc($rec)) {
			$sForwardText = $row["MessageText"];
		}
		mysql_free_result($rec);
	}

if (isset($_POST["go"]) && ($_POST["go"]==1)) {
	$arrSendTo = $_POST["sendto"];

	if (count($arrSendTo) == 0) {
		echo "<p><b><span color=red>Please select at least one recipient.</span></b></p>";
	} elseif (empty($_POST["message"])) {
		echo "<p><b><span color=red>Please enter a message to be sent.</span></b></p>";
	} else {
	
		$sFrom = "CETA Programme Coordinator";
		
		include("inc_sendmessage.php");
		
	}
} else {
?>    
    <form action="sendmessage.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <input type="hidden" name="go" value="1" />
      <table border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="72">Send To:</td>
          <td><label>
          Note: to select more than one, hold down your <br>
          CTRL key
          while clicking the selections you want.<br>


            <select name="sendto[]" id="sendto[]" multiple="multiple" size="5">
              <option value="CESA">CETA Programme Coordinator</option>
              <option value="SAll">All Candidates</option>
              <option value="MAll">All Mentors</option>
              <option value="EAll">All Employers</option>
<?php
$sql = "SELECT * FROM CCMStudents WHERE Archived=0 ORDER BY Surname, FirstName";
$rec = mysql_query($sql);
while ($row = mysql_fetch_assoc($rec)) {
?>              
              <option value="S<?php echo $row["CCMStudentID"]; ?>"<?php if ($iSelectStudentID == $row["CCMStudentID"]) echo " selected"; ?>><?php echo $row["SelectionCategory"]; ?> Candidate (<?php echo $row["Organisation"]; ?>): <?php echo $row["FirstName"]." ".$row["Surname"]; ?></option>
<?php
}
?>
<?php
$sql = "SELECT * FROM CCMMentors WHERE Archived=0 ORDER BY Surname, FirstName";
$rec = mysql_query($sql);
while ($row = mysql_fetch_assoc($rec)) {
?>              
              <option value="M<?php echo $row["CCMMentorID"]; ?>"<?php if ($iSelectStudentID == $row["CCMMentorID"]) echo " selected"; ?>>Mentor (<?php echo $row["Organisation"]; ?>): <?php echo $row["FirstName"]." ".$row["Surname"]; ?></option>
<?php
}
?>
<?php
$sql = "SELECT * FROM CCMEmployers WHERE Archived=0 ORDER BY Surname, FirstName";
$rec = mysql_query($sql);
while ($row = mysql_fetch_assoc($rec)) {
?>              
              <option value="E<?php echo $row["CCMEmployerID"]; ?>"<?php if ($iSelectStudentID == $row["CCMEmployerID"]) echo " selected"; ?>>Employer (<?php echo $row["Organisation"]; ?>): <?php echo $row["FirstName"]." ".$row["Surname"]; ?></option>
<?php
}
?>
            </select>
          </label>
          <br>Filter:<br>
          <input name="searchname" type="text" id="searchname" value="Enter part of name here" size="30" onKeyUp="myfilter.set(this.value)" /><br>
<A HREF="javascript:myfilter.reset()">Show All</A></td>
	<td>&nbsp;</td>
        </tr>
        <tr>
          <td>Subject:</td>
          <td colspan="2"><label>
            <input name="subject" type="text" id="subject" size="40" />
          </label></td>
        </tr>
        <tr>
          <td>Message:</td>
          <td colspan="2"><label>
            <textarea name="message" id="message" cols="75" rows="10"><?php 
	if (!empty($sReplyText) || !empty($sForwardText)) {
		echo "\r\n"."\r\n"."---------------------------------------------------------"."\r\n";
		echo $sReplyText;
		echo $sForwardText;
	}
?></textarea>
          </label></td>
        </tr>
        <tr>
          <td>Attachment:</td>
          <td colspan="2"><label>
          <input type="file" name="file1" id="file1" />
          </label></td>
        </tr>
      </table>
      <p>
        <label>
        <input type="submit" name="button" id="button" value="Send Now" />
        </label>
      </p>
    </form>
<SCRIPT TYPE="text/javascript">
<!--
var myfilter = new filterlist(document.getElementById("sendto[]"));
//-->
</SCRIPT>
<?php
}
?>    
    <p>&nbsp;</p>

<?php include "footer.php" ?>