File "tchat_site_new.php"

Full Path: /home/analogde/www/copy/tchat_site_new.php
File size: 6.91 KB
MIME-type: text/x-php
Charset: 8 bit

<?php
	session_start();
	include('database.php');
	DB_connexion(); 
	
	/*if(!isset($_SESSION['logged']) )
	{		header ('Location: interdiction.php');
	}
	
	if($_SESSION['logged']== "no")
	{
		header ('Location: interdiction.php');
	} */
	
	$chat_msg = '';
	$chat_destinataires= '';

    //vrifications des donnes (viter les attaques SQL)
            
    if (isset($_GET['msg'])) {
         $chat_msg = htmlspecialchars($_GET['msg'], ENT_QUOTES); //protection du message
    }

	if (isset($_GET['destinataire'])) {
         $chat_destinataires = htmlspecialchars($_GET['destinataire'], ENT_QUOTES); //protection des destinataires
    }
	
    // ajouter le nouveau message dans la base de donne
    if (isset($_GET['msg']) AND $_GET['msg'] != '' AND isset($_GET['action']) AND $_GET['action'] == 'chat') 
	{ //si tous les paramtres sont entrs
            mysql_query("INSERT INTO tchat VALUES('', '".$_SESSION['login']."', '".$chat_msg."' ,'".$chat_destinataires."', NOW() , '' )");
			header('Location:tchat_reload.php');
    }
	
?>

<!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=utf-8" />
<meta name="Description" content="Site perso,cours,ouvrages" />
<meta name="Keywords" content="WEBSITE perso " />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="" />
<meta http-equiv="Content-Language" content="fr" />
<meta name="rating" content="general" />
<meta name="author" content="Patrice DELPY" />
<meta name="copyright" content="Copyright 2013" />
<meta name="generator" content="Patoche" />
<title>Patoche WEBSITE - 2013 - Template du site - en cours de dveloppemment ...</title>
<!---------------------------------------------------------->	
<?php
		include('include_css_template_commun.php');
		include('include_css.php');
		include('css_tools_skill.php');
		include('include_javascript.php');

?> 

<style type="text/css">
			 
</style>

<link href="css/tchat_style.css" rel="stylesheet" type="text/css">	


<script type="text/javascript">
function call_update()
{
	 ajax_routine(); 
	 setTimeout("call_update()", 1000); //appelle la fonction 1 fois par  seconde
}
</script>

<!---------------------------------------------------------->	
</head>

<body>
<!---------------------------------------------------------->	
	<div class="main"> <!-- main -->
<!---------------------------------------------------------->	

          <div class="header">
                <div class="balise_titre">Patoche</div>
                <div class="balise_citation">
                &quot;Etre conscient que l'on est ignorant est un grand pas vers le savoir&quot;
                </div>
          </div> 
 
          <div class="banniere"></div>  

<!---------------------------------------------------------->
<?php
/*	include("include_barre_login.php");
	echo '<div id="box_icon">';
	include("debug_connexion_membre.php");
	echo '</div>';
	include("include_menu.php");*/
	
	echo '<div id="box_infos">';
			include("include_menu.php");
			
			echo '<div id="box_icon2">';
			include("connexion_membre.php");
			echo	'</div>';
			
			echo '<div id="box_icon3">';
			include("include_barre_login.php");
			echo	'</div>';

	echo	'</div>';
	$_SESSION['page_active'] = basename (__FILE__ );
?>
		

<!---------------------------------------------------------->	
            <div class="contenu"> <!-- contenu -->
<!---------------------------------------------------------->	
           
	<div id = "box_message">		
		<h2 class="retrait">Tchat du site.</h2>
	</div>
		
	<div class="centerblock">
	
				<div class="gauche">  
					<br/> 
						<div class="contenthead">Messages:</div>
							<div class="contentblock">
					
								<div id= "rafraichir">
<?php		
									$msgs=mysql_query('SELECT * FROM tchat ORDER BY id DESC LIMIT 0,50');
									$cpt = 0;
									while($infos = mysql_fetch_array($msgs)) {
								
									$champ = date('d-m-Y ', strtotime($infos["date_mess"])) ."    " .date(' H:i:s', strtotime($infos["date_mess"])); 
									$login = $infos["login"];
									$txt = $infos["mess"];
									$id = $infos["id"];
									$id = $infos["id"];
								
								   // echo '<p>';
								   // echo '<span class="pseudo">' . $msg['login'] . '</span>' . $msg['mess'];
								   // echo '</p>';
									echo '<div class="pseudo"><img src="images/puce_tchat_login.jpg" />&nbsp;'.$login.'</div> ';
									
									if($cpt%2 == 1) /* impair */
										echo '<div class="affiche_message_pair">'.$txt.'</div>';
									else /* pair */
										echo '<div class="affiche_message_impair">'.$txt.'</div>';
									
									echo '<div class="date">'.$champ.'<img src="images/puce_tchat_date.jpg" /></div>';
									
									$cpt = $cpt + 1;
									
								}             
?>					
								</div>
								
							</div>
				</div>
				
				
				<div class="droite">  
                <br/> 				
                	<div class="droitehead">Membres connects:</div>
					<div class="droiteblock">
                    
                    <select name="membres[]" id="membres" style="width: 200px; height:300px;"  multiple="multiple" > <!--onchange="recupSelected(this.value);"> -->
				
    				<option>text1</option>
				    <option>text2</option>
				    <option>text3</option>
				    <option>text4</option>
				    <option>text5</option>		
                    <option>text1</option>
				    <option>text2</option>
				    <option>text3</option>
				    <option>text4</option>
				    <option>text5</option>
                    <option>text1</option>
				    <option>text2</option>
				    <option>text3</option>
				    <option>text4</option>
				    <option>text5</option>
                    <option>text1</option>
				    <option>text2</option>
				    <option>text3</option>
				    <option>text4</option>
				    <option>text5</option>
                    
                    
					 </select>
					</div> 
                </div>
				
				
				<div class="saisir_message">  
					<form  action='<?=$_SERVER["PHP_SELF"];?>' method="get" name="formulaire_chat">
					<textarea rows="4" cols="50" name="msg" ></textarea> 
					<input type="hidden" name="destinataire" id="destinataire" value="" />	
					<input type="hidden"  name="action" id="action"  value="" />
					<input type="submit" value="Envoyer" onclick="traitement();" /> 
					</form>
				</div> 
	
	
	</div>		
	
	<br/>
	<br/>
	
           

<!---------------------------------------------------------->	
<?php			
    include('include_pied_page.php');
	include('include_publicite.php');
?>
<!---------------------------------------------------------->	
			</div>  <!-- contenu -->
<!---------------------------------------------------------->	
	</div>   <!-- main -->
<!---------------------------------------------------------->	

	<script type="text/javascript">
		call_update()
	</script>
	
	<script type="text/javascript">
		callUpdateChat() 
    </script>

</body>
</html>