Location: PHPKode > scripts > TJSChat > tjschat/connect.php
<?php
   include "param.php";
   include "mysql.php";
   Connection();
   if ((!isset($_GET['user']))||(!isset($_GET['dummy']))) {
      print($param["text_error_connect"]);
      exit;
   }
   $query="SELECT * FROM ".$param["table_salle"]." WHERE user='".$_GET['user']."' AND dt_first=".$_GET['dummy'];
   $result=mysql_query($query) or die(mysql_error());
   if (mysql_num_rows($result)==0) {
      print($param["text_error_connect"]);
      exit;
   }
?>

<html><head>
<title><?php print($param["title"]); ?></title>

<script type="text/javascript">
var ID=<?php print('"'.$_GET['user'].'"'); ?>;
var user=<?php print('"'.$_GET['user'].'"'); ?>;

var dt_connect=<?php print(date("YmdHis")); ?>;
var dt_last_liste=1; var dt_last_connect=1; var dt_last_chat=1;
var delai_liste=<?php print($param["chat_timer"]*1000); ?>; var delai_connect=""; var delai_chat="";
var top_wait=1;

var load_liste=0; var load_coeur=0; var load_main=0
var load=0; var top_wait=0;
var msg=""; var color="";

function coeur() { 
   if (load==0) {// Chargement des frames en cours
      DetectLoad();
   }
   if (load==1) {// Chargement vient de se terminer
      ConnectCoeur();      
      load=9;
      setTimeout("coeur()",delai_liste);
   }
   if (load==9) {// Fonctionnement normal
      ConnectCoeur();
      setTimeout("coeur()",delai_liste);
   }
}

function ConnectCoeur() {
   if (msg=="") {
      top_wait=1;
      window.defaultStatus="<?php print($param["status_receive"]); ?>";
      frames["menu"].frames["coeur"].location="coeur.php?dt_last_liste="+dt_last_liste+"&user="+ID+"&dt_last_chat="+dt_last_chat;
   }
}

function CoeurLoad() {
   top_wait=0;
   msg="";
   top.defaultStatus="<?php print($param["status_default"]); ?>";
}

function DetectLoad() {
   window.defaultStatus="<?php print($param["status_connect"]); ?>";
   if ((load_liste==1)&&(load_coeur==1)&&(load_main==1)) { // 1er chargement OK
      load=1;
   }
   setTimeout("coeur()",250);
}

function SendMsg(f) {
   if (msg=="") {
      msg=f.msg.value;
      if (msg!="") {
         msg=msg.replace("+","plus");
         color=f.color.options[f.color.selectedIndex].value;
         f.msg.value="";
         window.defaultStatus="<?php print($param["status_send"]); ?>"
         msg="&msg="+msg+"&color="+color;
         frames["menu"].frames["coeur"].location="coeur.php?dt_last_liste="+dt_last_liste+"&user="+ID+"&dt_last_chat="+dt_last_chat+msg;
      }
   } else {
      alert("<?php print($param["status_wait"]); ?>");
   }
}

///////////////////
function PrintMsg(lesmsg) {
   top.frames['main'].document.getElementById('layermsg').innerHTML=lesmsg;
   var hauteur=top.frames['main'].document.getElementById('layermsg').clientHeight;
   if (hauteur><?php print($param["chat_form_height"]); ?>) {
      top.frames['main'].document.getElementById('layermsg').style.top=<?php print($param["chat_form_height"]); ?>-hauteur;
   } else {
      top.frames['main'].document.getElementById('layermsg').style.top=0;
   }
}

///////////////////
function AddUser(user) {
   val=parent.frames['main'].document.forms["post"].elements["msg"];
   val.value=user+" > "+val.value;
   val.focus();
}
function Quitter() {
   if (confirm("<?php print(str_replace("(user)", $_GET['user'], $param["text_sure_quit"])); ?>")) {
      top.location="quit.php?user="+ID;      
   }
}
function Popup() {
// top.focus();
// top.frames["main"].post.msg.focus();
}


//////////
coeur();
//////////

</script>
</head>

<frameset cols="600,*"  border=0 frameborder=0>
   <frame name="main" src="principal.php" marginwidth=0 marginheight=0 noresize frameborder=0 scrolling='no' border=0>
   <frame name="menu" src="menu.php?user=<?php print $_GET['user']; ?>" marginwidth=0 marginheight=0 noresize frameborder=0 scrolling='no' border=0>
</frameset>
</html>
Return current item: TJSChat