Location: PHPKode > projects > Pnyx : des lections virtuelles! > pnyx1.0.1/msg_rep.php
<?

	#########################################################################################
	# Envoie d'un message par un responsable de Pnyx										#
	# Auteur : V. Blais																		#
	# Création : 2006-05-02																	#
	# Modification : 2008-08-22																#
	# 																						#
	# Pnyx - une application Web (PHP/MySQL) d'élections virtuelles conçue pour	des	élèves	#
	# du primaire et du secondaire, dans lequel ils sont amenés à faire des	propositions	#
	# en ligne et voter pour leur favorite, sous la supervision d'un enseignant.			#
	#																						#
    # Copyright (C) <2008 - 2009>															#
	# <Service national du RÉCIT de l'univers social de la Commission scolaire de la		#
	# Pointe-de-l'Île>																		#
	#																						#
	# This program is free software; you can redistribute it and/or modify it under the 	#
	# terms of the GNU General Public License as published by the Free Software Foundation.	#
	# This program is distributed in the hope that it will be useful, but WITHOUT ANY 		#
	# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 		#
	# PARTICULAR PURPOSE.  See the GNU General Public License for more details.				#
	# You should have received a copy of the GNU General Public License along with this 	#
	# program as the file LICENSE.txt; if not, please see 									#
	# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.									#
	# 																						#
	# Service national du RÉCIT de l'univers social											#
	# http://www.recitus.qc.ca																#
	# Contact e-mail : steve-hide@address.com												#
	#########################################################################################

	require "entete_php.php";
	
		# ou verifier si la session est valide 
		# puis verifier si l'usager dispose des autorisations requises
		# pour la saisie
		verifier_session();
		acces_eleve("ele_discussion.php");
		
		/*$idp = $HTTP_SESSION_VARS['SESSION']['projet'];
		$ide = $HTTP_SESSION_VARS['SESSION']['usager_id'];*/

if (isset($HTTP_POST_VARS['type_action'])){
	if ($HTTP_POST_VARS['type_action'] == "envoyer"){
		$date = date("Y-m-d");
		$time = date("H:i:s");
		$temps = $date." ".$time;
		$texte = addslashes($HTTP_POST_VARS['texte']);
		
		$requete_sql = "INSERT INTO msg_fil (fil_id, auteur, type_auteur, destinataire, date, titre, texte, projet_id)
						VALUES ( \" $HTTP_POST_VARS[id_fil]\", \"$usager\", \"eleve\", \"$HTTP_POST_VARS[id_dest]\",
									\"$temps\", \"".addslashes($HTTP_POST_VARS["titre"])."\", \"$texte\", $projet)";
			
		$reponse_msg = bd_executer_sql($requete_sql);
			
		$requete_sql = "UPDATE fil_discussion 
						SET date_last_msg = \"$temps\", 
							last_auteur = $usager, 
							type_auteur = \"eleve\",
							last_destinataire = \"$HTTP_POST_VARS[id_dest]\" 
						WHERE fil_id = $HTTP_POST_VARS[id_fil]
						";
							
			$reponse_fil = bd_executer_sql($requete_sql);
			
		
			$HTTP_SESSION_VARS['SESSION']['message'] = "Le message est envoyé."; 
		
	}
} else{

$requete_sql = "SELECT * FROM fil_discussion
				WHERE fil_id = $HTTP_GET_VARS[id_fil]";
		
$reponse_grp = bd_executer_sql($requete_sql);
$msg = mysql_fetch_array($reponse_grp);
}
	
	$requete_sql = "SELECT titre
					FROM site_parametres
					";
	$reponse_titre = mysql_query($requete_sql);
	$ligne_titre = mysql_fetch_array($reponse_titre);
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title><?= $ligne_titre['titre'] ?></title>

<script type="text/javascript" src="lib/fonctions.js"></script>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1684383-1";
urchinTracker();
</script>
</head>
<body bgcolor="#FFFFFF">
<?
if (isset($HTTP_POST_VARS['type_action'])){
	if ($HTTP_POST_VARS['type_action'] == "envoyer"){
?>
		<script language="JavaScript">
			refresh_parent(); 
		</script>
<?
	}
}
?>	
<form action="msg_rep.php" name="form_mod_groupe" method="post">
		<table width="664" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
		<tr>
		<td colspan="2">&nbsp;</td>
		</tr>
		<tr>
		<td colspan="2"><?
if (isset($HTTP_POST_VARS['type_action'])){	
	if ($HTTP_POST_VARS['type_action'] == "envoyer"){
		echo "<br>$message";
		$message="";
	}
}else{ 
		
	
?></td>
		</tr>
		<tr>
		<td width="78" valign="top"><p><strong>Titre :</strong></p></td>
		<td width="586"><input type="hidden" name="titre" value="Re: <?= $msg['titre']?>"/> Re: <?= $msg['titre']?></td>
		</tr>
		<tr>
		<td width="78" valign="top"><p><strong>Texte :</strong></p></td>
		<td width="586"><textarea name="texte" cols="60" rows="10"></textarea> </td>
		</tr>
		<tr>
		<td colspan="2"><p>&nbsp;</p></td>
		</tr>
		<tr>
		<td colspan="2" align="center"><input type="submit" name="Submit3" value="Envoyer"/>
			<input type="hidden" name="type_action" value="envoyer" />
			<input type="hidden" name="id_fil" value="<?=$HTTP_GET_VARS['id_fil']?>" />
<?
		echo "<input type='hidden' name='id_dest' value='$HTTP_GET_VARS[id_dest]' />";
}
?>
			&nbsp;&nbsp;&nbsp;<input type="button" value="Fermer" onclick="self.close()" />
		</td>
		</tr> 
		<tr>
		<td colspan="2"><p>&nbsp;</p></td>
		</tr>
    	</table>
		</form>
<?
	mysql_close();
?>
</body>
</html>
Return current item: Pnyx : des lections virtuelles!