PHP Classes

File: template/content/chat.php

Recommend this page to a friend!
  Classes of adam berger   Separation Database Queries   template/content/chat.php   Download  
File: template/content/chat.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Separation Database Queries
Database access trait using PDO
Author: By
Last change:
Date: 6 years ago
Size: 2,869 bytes


Class file image Download
//require_once(dirname(__FILE__) . '/lib/Autoload.php');
$sessia = new UserSesionClass();
$user = new DbSelectUser();

  $( document ).ready(function() {
            $( "#chat" ).load( "pliki/load-select-chat.php" );
          }, 5000);

  function loadPost(){
             document.newconntentform.newconntent.value = ''; // wyczysc textera
                tresc = $( 'textarea[name="newconntent"]' ).val();
                user = $( 'input[name="user"]' ).val();
        type: "POST",
            url: 'pliki/baza-czat.php',
        data: { tresc: tresc, user: user}, // Dane przesy?ane $_POST
                        cache: false,
       $('#loading').show().html('<img src="loading.gif" alt="Loading..." />');;
       success: function(data){
     //document.newconntentform.newconntent.value = ''; // wyczysc textera
    complete : function(data) {
     $('#chat').append('<b>User:</b> '+user+' -> '+tresc+'<br>');
     error: function(data) {
    alert("ERROR: "+data)
    return false;
// Jest sesja
// przypisujemy id user otrzymany z sesji
$userName = $user->select_user_all($sessia->getSesion('IsUser'));
<section class="">
        <div id="divchat">
        <div id="loading"></div>
          <h2 class="username-chat-name"><b>Chat Ber</b></h2>
<span class="chatGo"><b>Rozpocznij czat</b> <input class="zzzz" type="button" id="add" value="+"></span>
// $user = rand(1,99999);
     // Username
$user = $userName['name'];
       <h3 class="username_chat"><?php echo 'User: '.$user; ?></h3>
              <div id="chat"></div>
        <div class="message">
         <form id="newconntentform" name="newconntentform" action="#" method="post" onsubmit="return false;">
           <div class="leftChat">
         <textarea rows="8" class="textera" name="newconntent" id="newconntent" ></textarea>
          <input type="hidden" id="user_chat" name="user" value="<?php echo $user; ?>" />
            <div class="right">
              <input type="submit" name="submit" onclick="loadPost()" id="newconntentsubmitchat" value="wy?lij" />
    </div> </section>
// Koniec z sesji