le 13/08/2006 à 12:50
speedylol
bonjour voilà le probléme que je rencontre , j'ai réalisé deux script pour un chat entre membre online, donc les message rendre dans la base de donnée j'ai un soucis avec liens de lecture , et le champs open pour faire disparaître mon liens message et qui n'apparîse plus quand le fenêtre de lecture est ouverte. plus simple voici les deux code .
la lecture
je n'est pas oublier la fermeture de mes script ;-)
$nb_mess = mysql_query("SELECT * FROM chatonline WHERE dest='$pseudom'") or die (mysql_error());
$nb_mess_i = mysql_num_rows($nb_mess);
while($row = mysql_fetch_array($nb_mess)){
$open = $row['open'];
if($open == 0 && $nb_mess_i > 0)
{
echo "<bgsound src='design/chat.wav'>";
}
if(!empty($open) && !empty($nb_mess_i))
{
echo "<center><b><a href="#" onClick="window.open('messachat1.php?expe=$expe','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=400, height=120, right=1, top=0');return(false)">Message Reçu</a></b></center>";
}
else
{
mysql_query("UPDATE chatonline SET open='1' WHERE dest='$pseudom'")or die (mysql_error());
}
}
?>
la lecture
<?php
session_start();
require_once'config.php';
$chat = mysql_query("SELECT expe, messy FROM chatonline WHERE dest='".$_SESSION['login']."' ORDER BY id_chat ASC");
?>
<html>
<head>
<title>Dialogue-Priver</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5;url="javascript:navigator.url">
<style type="text/css">
BODY
{
scrollbar-face-color: #0099CC;
scrollbar-shadow-color: #3333CC;
scrollbar-highlight-color: #CCCCFF;
scrollbar-3dlight-color: #99CCCC;
scrollbar-darkshadow-color: #000000;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
}
</style>
<SCRIPT language=JavaScript>
var version = "other"
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3) version = "n3";
else if (browserName == "Netscape" && browserVer < 3) version = "n2";
else if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) version = "e4";
else if (browserName == "Microsoft Internet Explorer" && browserVer < 4) version = "e3";
var y = 0;
var test = 0;
function scroll_bas() {
if (version == "n2" || version == "n3" || version == "e4"){
//vous devez régler le 1000 qui suit si votre texte est plus grande que 1000 pixels
if (y < 1000) {
window.scroll(0,y);
y = y + 25;
//régler le 0 ci-dessous pour la vitesse de descente
if (test==0) {setTimeout('scroll_bas()', 0);}
}
}
}
</SCRIPT>
</head>
<body onload="scroll_bas();">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<?php while ($rs1 = mysql_fetch_array($chat))
{
$expe = $rs1['expe'];
$messy= $rs1['messy'];
echo"<left><b>$expe</b><a href="#" onClick="window.open('detailspopup.php?det=$expe','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=600, height=550, right=1, top=0');return(false)"><img src="design/voir.gif" width="20" heigth="25" border="0" title="Profil"></a>
<a href="#" onClick="window.open('messa.php?dest=$expe&chat=$chat','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=400, height=200, right=1, top=0');return(false)"><img src="design/chat.gif" width="15" heigth="15" border="0" title="chat"></a>";
echo" => $messy </left>";
}
$chat2 = mysql_query("select count(id_chat) AS nb_mess from chatonline WHERE dest='".$_SESSION['login']."'");
$nb_mess = mysql_result($chat2,0,"nb_mess");
if($nb_mess >=6){
$chat3 = mysql_query("select min(id_chat) AS min_mess from chatonline WHERE dest='".$_SESSION['login']."'");
$min_mess = mysql_result($chat3,0,"min_mess");
$chat4 = mysql_query("delete from chatonline where id_chat=".$min_mess."");
}
je n'est pas oublier la fermeture de mes script ;-)