1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| <?php
@session_start();
?>
<html>
<title>Belnuance</title>
<head>
<script language="javascript" type="text/javascript">
nom_de_la_page='recumessagechat.php';
var xhr=null;
function rafraichir() {
if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
else alert('JavaScript : votre navigateur ne supporte pas les objets XMLHttpRequest...');
xhr.open('GET',nom_de_la_page,true);
xhr.onreadystatechange = ajaxReponse;
xhr.send(null);
}
function ajaxReponse() {
if (xhr.readyState == 4) {
document.getElementById('droite').innerHTML=xhr.responseText;
var timer=setTimeout("rafraichir()",3000);
}
}
rafraichir();
</script>
</head>
<style>
#droite {
position:relative;
}
</style>
<body onLoad="charge();">
<?php
if (!isset($_SESSION['login'])) {
echo "<script language=\"JavaScript\">
setTimeout(\"window.location='index.php'\",0); // delai en millisecondes
</script>";
exit();
}
//Fichier necessaire
require_once'../include/connexion.inc';
//Verifie si on s'est connecte a l'espace membre
$pseudom=$_SESSION["login"];
$pass=md5($_SESSION["pass_md5"]);
$sql = "SELECT * FROM fk_membres WHERE login='$pseudom' and pass_md5='$pass'";
$nb_mess = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$nb_mess = mysql_query("SELECT id_chat,open FROM chatonline WHERE dest='$pseudom' GROUP BY open ") or die (mysql_error());
while($ligne = mysql_fetch_array ($nb_mess)){
$id_chat = $ligne['id_chat'];
$open = $ligne['open'];
if($open==0)
{
}
if($open==0)
{
echo"<div id=\"droite\" align=\"center\"><a href=\"#\" onClick=\"window.open('../chat/messachat1.php?id_chat=$id_chat','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=400, height=200, right=1, top=0');return(false)\"><img src=\"../design/Mrecu.gif\" width=\"100\" height=\"15\" border=\"0\" title=\"Message reçu\"></a></div>";
}
}
?>
</body>
</html> |
Partager